Wear leveling method and device, equipment and storage medium

By dynamically adjusting the writing operation of data in Flash memory, combined with static and dynamic wear leveling technology, uniform wear distribution is achieved, extending the life of the memory and improving performance, solving the problems of uneven wear and performance overhead.

CN118860291APending Publication Date: 2024-10-29SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202411151181.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

The limited erase and write life of Flash memory causes uneven wear, affecting its reliability and life. Existing wear leveling technology has problems with performance overhead and inflexible thermal data processing.

Method used

By obtaining the access frequency of each physical block, determining hot data and cold data, dynamically adjusting write operations, combining static wear balancing and dynamic wear balancing, using address mapping tables and erase counters to achieve data migration and garbage collection, and evenly distribute writes entry and erase operations.

Benefits of technology

It extends the service life of Flash memory, improves responsiveness and overall performance, reduces energy consumption and maintenance costs, and reduces the frequency of memory replacement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860291A_ABST
    Figure CN118860291A_ABST
Patent Text Reader

Abstract

The invention discloses a wear leveling method and device, equipment and a storage medium, and relates to the technical field of computer storage, and the wear leveling method comprises the following steps: obtaining an access frequency of data in each physical block of a Flash memory within a preset duration to obtain a target access frequency; judging whether the target access frequency corresponding to each physical block is greater than a preset access frequency; if yes, determining that the physical block greater than the preset access frequency is a hot data block, and loading hot data in the hot data block into a cache; if not, determining that the physical block not greater than the preset access frequency is a cold data block, scanning the cold data block according to a first preset period, and migrating cold data in the cold data block to the first data block; and when a data writing request is received, obtaining the current erasing times of each physical block, and writing data to be written into the physical block corresponding to the minimum erasing times. Abrasion of the memory can be reduced, the service life is prolonged, and the response capability and the overall performance of the memory are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the rapid development of information technology, Flash memory has been widely used in various storage devices such as embedded systems, mobile devices, and solid-state drives (SSDs) due to its advantages such as high density, low power consumption, and non-volatility. Flash memory mainly includes NOR Flash and NAND Flash, among which NAND Flash is widely used due to its high storage density and low cost. However, Flash memory has the characteristic of limited erase and write life, that is, each storage unit can only withstand a limited number of erase and write operations. Excessive erase and write operations will cause the storage block (i.e., Block, physical block) to wear out, thereby affecting the life and reliability of Flash memory.

[0003] In actual applications, some storage blocks may wear out quickly due to frequent data updates, while other storage blocks may maintain a longer service life due to less data updates. This uneven wear will cause some blocks in the Flash memory to fail prematurely, thus affecting the reliability of the entire Flash memory. In order to extend the service life of the Flash memory, effective wear leveling (WL) technology is required to avoid excessive wear of certain blocks by evenly distributing write and erase operations.

[0004] At present, wear leveling technology is mainly divided into two categories: static wear leveling and dynamic wear leveling. The static wear leveling method balances the number of erases and writes of all blocks by periodically moving cold data (data that is not written frequently), while the dynamic wear leveling method selects the block with the least number of erases and writes for each write operation. However, although these methods can extend the life of Flash memory to a certain extent, there are still some problems, such as the performance overhead caused by data movement operations and the inflexible handling of hot data (data that is written frequently). Summary of the invention

[0005] In view of this, the purpose of this application is to provide a wear leveling method, device, equipment and storage medium, which can reduce the wear of Flash memory, extend the service life of Flash memory, improve the responsiveness and overall performance of the memory, reduce energy consumption, and thus reduce the replacement frequency and maintenance cost of the memory. The specific scheme is as follows:

[0006] In a first aspect, the present application discloses a wear leveling method, which is applied to a Flash memory, comprising:

[0007] Acquire the access frequency of data in each physical block of the Flash memory within a preset time length, and obtain the target access frequency corresponding to each physical block;

[0008] respectively determining whether a target access frequency corresponding to each of the physical blocks is greater than a preset access frequency;

[0009] If the target access frequency corresponding to the physical block is greater than the preset access frequency, the physical block with a frequency greater than the preset access frequency is determined to be a hot data block, and hot data in the hot data block is loaded into the cache;

[0010] If the target access frequency corresponding to the physical block is not greater than the preset access frequency, the physical block with the access frequency not greater than the preset access frequency is determined to be a cold data block, and the cold data block is scanned according to a first preset period, and the cold data in the scanned cold data block is migrated to a first data block; the number of erasure times of the first data block is greater than a first erasure times threshold;

[0011] When a data write request is received, the current erase and write counts of each physical block are obtained, the latest erase and write counts corresponding to each physical block are obtained, and the minimum value of all the latest erase and write counts is determined to obtain the minimum erase and write count, and then the data to be written is written to the physical block corresponding to the minimum erase and write count.

[0012] Optionally, the wear leveling method further includes:

[0013] Determine respectively the logical blocks corresponding to the physical blocks in the Flash memory, and create a mapping table based on the correspondence between the logical addresses of the logical blocks and the physical addresses of the physical blocks to obtain an address mapping table;

[0014] An erase counter is configured for each physical block corresponding to each physical address in the address mapping table to count the erase times of the corresponding physical block, obtain the latest erase times corresponding to each physical block, and save the latest erase times in the memory and the hard disk in sequence; the erase counter is pre-integrated in the control circuit corresponding to the physical block.

[0015] Optionally, the creating a mapping table based on the correspondence between the logical address of the logical block and the physical address of the physical block to obtain the address mapping table includes:

[0016] respectively obtaining the logical address of each of the logical blocks; the logical address includes a page number and an offset within the page;

[0017] The physical address corresponding to the physical block is calculated based on the preset page size and the logical address, and the physical address is mapped with the corresponding logical address, and the mapped physical address and the corresponding logical address are saved in a preset mapping table to obtain an address mapping table.

[0018] Optionally, the storing the latest number of erasures and writes in the memory and the hard disk in sequence includes:

[0019] Using a hash table data structure to record the latest number of erase and write times corresponding to all the physical blocks to obtain hash table structure data;

[0020] The hash table structure data is sequentially saved in the memory and the hard disk according to a second preset period.

[0021] Optionally, when receiving a data write request, obtaining the current erasure count of each physical block to obtain the latest erasure count corresponding to each physical block includes:

[0022] When a data write request is received, the erasing and writing times of each physical block in the current Flash memory are obtained from the memory or the hard disk to obtain the latest erasing and writing times corresponding to each physical block.

[0023] Optionally, the wear leveling method further includes:

[0024] Monitor the count value of the erase / write counter corresponding to each physical block in the Flash memory in real time to obtain the erase / write count value corresponding to each physical block;

[0025] respectively determining whether the difference between the erase count value corresponding to each of the physical blocks and the maximum erase count is within a preset range;

[0026] If the difference between the erase count value corresponding to the physical block and the maximum erase count is within the preset range, the physical block within the preset range is determined as a high-wear data block, and data in the high-wear data block is migrated to a second data block; wherein the erase count of the second data block is less than a second erase count threshold, and the second erase count threshold is less than the first erase count threshold;

[0027] If the difference between the erase count value corresponding to the physical block and the maximum erase count is not within the preset range, the physical block not within the preset range is determined as a low-wear data block; the second data block belongs to the low-wear data block;

[0028] Correspondingly, after writing the data to be written into the physical block corresponding to the minimum erasing number, the method further includes:

[0029] After writing is completed, the address mapping table and the count value of the erase counter of the physical block corresponding to the minimum erase number are updated.

[0030] Optionally, the wear leveling method further includes:

[0031] The physical blocks in the Flash memory are scanned in sequence according to a third preset cycle to determine the physical blocks from which data has been deleted, and garbage collection is performed on the physical blocks from which data has been deleted in descending order of the number of erase and write times.

[0032] In a second aspect, the present application discloses a wear leveling device, which is applied to a Flash memory, comprising:

[0033] A frequency acquisition module, used to acquire the access frequency of data in each physical block of the Flash memory within a preset time length, and obtain a target access frequency corresponding to each physical block;

[0034] A judging module, used for judging whether the target access frequency corresponding to each of the physical blocks is greater than a preset access frequency;

[0035] A first determination module, configured to determine that the physical block having a target access frequency greater than the preset access frequency is a hot data block if the target access frequency corresponding to the physical block is greater than the preset access frequency;

[0036] A loading module, used for loading the hot data in the hot data block into a cache;

[0037] A second determination module, configured to determine that the physical block with a target access frequency not greater than the preset access frequency is a cold data block if the target access frequency corresponding to the physical block is not greater than the preset access frequency;

[0038] A scanning and migration module, configured to scan the cold data block according to a first preset period, and migrate the cold data in the scanned cold data block to a first data block; the erasure number of the first data block is greater than a first erasure number threshold;

[0039] The erase and write count acquisition module is used to acquire the erase and write count of each of the current physical blocks when receiving a data write request, and obtain the latest erase and write count corresponding to each of the physical blocks;

[0040] The data writing module is used to determine the minimum value of all the latest erasing times to obtain the minimum erasing times, and then write the data to be written into the physical block corresponding to the minimum erasing times.

[0041] In a third aspect, the present application discloses an electronic device, comprising a processor and a memory; wherein the processor implements the aforementioned wear leveling method when executing a computer program stored in the memory.

[0042] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned wear leveling method is implemented.

[0043] It can be seen that the present application first obtains the access frequency of the data in each physical block of the Flash memory within a preset time length, obtains the target access frequency corresponding to each physical block, and then respectively determines whether the target access frequency corresponding to each physical block is greater than the preset access frequency. If the target access frequency corresponding to the physical block is greater than the preset access frequency, the physical block greater than the preset access frequency is determined to be a hot data block, and the hot data in the hot data block is loaded into the cache; if the target access frequency corresponding to the physical block is not greater than the preset access frequency, the physical block less than the preset access frequency is determined to be a cold data block, and the cold data block is scanned according to a first preset period, and the cold data in the scanned cold data block is migrated to the first data block; the number of erasures and writes of the first data block is greater than the first erasure number threshold; when a data write request is received, the number of erasures and writes of the current physical blocks is obtained, the latest number of erasures and writes corresponding to each physical block is obtained, and the minimum value of all the latest number of erasures and writes is determined to obtain the minimum number of erasures and writes, and then the data to be written is written to the physical block corresponding to the minimum number of erasures and writes. The present application first obtains the access frequency of data in each physical block in the Flash memory within a preset time length, and then determines whether the access frequency corresponding to each physical block is greater than the preset access frequency. If so, the corresponding physical block is determined to be a hot data block, and the hot data in the hot data block is loaded into the cache. Otherwise, the corresponding physical block is determined to be a cold data block, and the cold data in the scanned cold data block is regularly migrated to a new data block. It can be seen that the present application adopts different wear leveling strategies for hot data and cold data. By loading hot data into the cache, it can cope with frequent reading and writing and reduce frequent access to a single physical block. By migrating cold data to a new data block with relatively more erase and write times, the physical block with less erase and write times can be vacated to process hot data, thereby ensuring wear leveling of the cold data blocks. In addition, when a data write request is received, the latest erase and write count of the current physical block is obtained, and the data to be written is written to the physical block corresponding to the minimum value of all the latest erase and write counts. In this way, the wear of each physical block can be dynamically balanced during the write operation. It can be seen that when performing wear leveling on the Flash memory, the present application adopts both static wear leveling and dynamic wear leveling methods, and combines the access frequency of the physical block and the hot and cold data classification technology, so as to achieve the purpose of uniform wear and efficient use of the Flash memory storage resources. At the same time, the wear of the Flash memory is reduced, the service life of the Flash memory is extended, the responsiveness and overall performance of the memory are improved, the energy consumption is reduced, and the replacement frequency and maintenance cost of the memory are reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0045] Figure 1 A flow chart of a wear leveling method disclosed in this application;

[0046] Figure 2 A specific wear leveling method flow chart disclosed in this application;

[0047] Figure 3 This is a schematic diagram of the structure of a wear leveling device disclosed in this application;

[0048] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

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

[0050] The present application discloses a wear leveling method, which is applied to a Flash memory. Figure 1 As shown, the method includes:

[0051] Step S11: acquiring the access frequency of data in each physical block of the Flash memory within a preset time period, and obtaining the target access frequency corresponding to each physical block.

[0052] It should be pointed out that this solution is applicable to scenarios such as embedded systems, mobile devices, and data centers that require frequent read and write operations using Flash memory, and is specifically applied to Flash memory.

[0053] In this embodiment, firstly, the access frequency of data in each physical block in the Flash memory within a preset time (such as 10 seconds) is acquired, so as to obtain the target access frequency corresponding to each physical block.

[0054] Step S12: determining respectively whether the target access frequency corresponding to each of the physical blocks is greater than a preset access frequency.

[0055] In this embodiment, after obtaining the target access frequency corresponding to each physical block, it is further determined whether the target access frequency corresponding to each physical block is greater than the preset access frequency f. If the target access frequency is greater than the preset access frequency f, it indicates that the access frequency of the corresponding data block is relatively high. If the target access frequency is not greater than the preset access frequency f, it indicates that the access frequency of the corresponding data block is relatively low.

[0056] Step S13: If the target access frequency corresponding to the physical block is greater than the preset access frequency, the physical block with a frequency greater than the preset access frequency is determined to be a hot data block, and hot data in the hot data block is loaded into the cache.

[0057] In this embodiment, if the target access frequency corresponding to the physical block is greater than the above-mentioned preset access frequency f, it indicates that the access frequency of the data block is relatively high. At this time, the physical block with a frequency greater than the above-mentioned preset access frequency f can be determined as a hot data block, and then the hot data in the hot data block is loaded into the cache, that is, the data in the frequently accessed physical block is loaded into the cache to facilitate frequent data reading and writing, avoiding frequent erase and write operations on the same data block, that is, avoiding excessive wear of a single block.

[0058] Step S14: If the target access frequency corresponding to the physical block is not greater than the preset access frequency, the physical block with an access frequency not greater than the preset access frequency is determined to be a cold data block, and the cold data block is scanned according to a first preset period, and the cold data in the scanned cold data block is migrated to the first data block; the number of erase and write times of the first data block is greater than a first erase and write time threshold.

[0059] In this embodiment, if the target access frequency corresponding to the physical block is not greater than the above-mentioned preset access frequency f, it indicates that the access frequency of the data block is low. At this time, the physical block that is not greater than the above-mentioned preset access frequency f can be determined as a cold data block, and then the above-mentioned cold data block is scanned according to the first preset period (T1), and the cold data in the scanned cold data block is migrated to the first data block; wherein the number of erasure times of the first data block is greater than the first erasure time threshold C1.

[0060] In a specific implementation, the cold data migration operation can be completed by an offline scheduled task to avoid the high read and write time period, and the execution period can be preset by configuring parameters, such as performing cold data migration every 60 seconds.

[0061] In addition, it can be understood that as the cold data in the cold data block is continuously accessed, the cold data may be updated to hot data, and at this time, the hot data processing may be performed according to step S13.

[0062] It should be pointed out that, according to the data classification result, the present application stores hot data and cold data in different storage areas respectively. In this way, different wear leveling strategies can be adopted for hot data and cold data. Specifically, the cold data in different cold data blocks can be distributed to different first data blocks of the Flash memory through wear leveling, wherein the number of erasures and writes of the first data blocks is relatively large. By migrating the cold data to new data blocks with relatively large number of erasures and writes, the physical blocks with small number of erasures and writes can be freed up to process the hot data, thereby effectively preventing the long-term idle wear of the cold data blocks, reducing the additional data movement operations, and reducing the performance overhead.

[0063] Step S15: When a data write request is received, the current erase and write counts of each physical block are obtained, the latest erase and write counts corresponding to each physical block are obtained, and the minimum value of all the latest erase and write counts is determined to obtain the minimum erase and write count, and then the data to be written is written to the physical block corresponding to the minimum erase and write count.

[0064] In this embodiment, when a data write request is received, the erase and write counts of each current physical block are first obtained to obtain the latest erase and write counts corresponding to each physical block. Then, the minimum value is determined from all the above latest erase and write counts to obtain the minimum erase and write count, that is, the data block with the least erase and write counts in the entire Flash memory is determined. At this time, in order to balance the wear, the data to be written can be written to the physical block corresponding to the minimum erase and write count.

[0065] In addition, the wear leveling method may further include: scanning each physical block in the Flash memory in sequence according to a third preset cycle to determine the physical block of the deleted data, and performing garbage collection on the physical block of the deleted data in the order of the number of erases from large to small. In this embodiment, each physical block in the Flash memory is scanned in sequence according to the third preset cycle T3, and after scanning the physical block of all data deleted, the physical block of the deleted data can be garbage collected by using the garbage collection mechanism. In the garbage collection process, the scanned physical blocks of the deleted data can be sorted in the order of the number of erases from large to small, and then the physical blocks with more erases are preferentially recycled, that is, the physical blocks with high wear are preferentially recycled, and specifically, they can be re-added to the available data block pool, so as to timely recycle the resource space, avoid repeated scanning of empty data blocks, improve the fast scanning speed, and further balance the wear of each physical block. It should be pointed out that in the process of garbage collection, the number of moves of valid data should be minimized, so as to reduce the performance overhead caused by garbage collection. It is understandable that the garbage collection mechanism, as an important component of wear leveling, has a direct impact on the life and performance of the memory. The above-mentioned efficient garbage collection mechanism can not only reclaim the storage space occupied by deleted data, but also avoid repeated erasure of valid data as much as possible, thereby further improving the life of the Flash memory.

[0066] It can be seen that the embodiment of the present application first obtains the access frequency of the data in each physical block of the Flash memory within a preset time length, obtains the target access frequency corresponding to each physical block, and then judges whether the target access frequency corresponding to each physical block is greater than the preset access frequency. If the target access frequency corresponding to the physical block is greater than the preset access frequency, the physical block greater than the preset access frequency is determined to be a hot data block, and the hot data in the hot data block is loaded into the cache; if the target access frequency corresponding to the physical block is not greater than the preset access frequency, the physical block less than the preset access frequency is determined to be a cold data block, and the cold data block is scanned according to a first preset period, and the cold data in the scanned cold data block is migrated to the first data block; the number of erasures and writes of the first data block is greater than the first erasure and write count threshold; when a data write request is received, the number of erasures and writes of the current physical blocks is obtained, the latest number of erasures and writes corresponding to each physical block is obtained, and the minimum value of all the latest number of erasures and writes is determined to obtain the minimum number of erasures and writes, and then the data to be written is written to the physical block corresponding to the minimum number of erasures and writes. The present application first obtains the access frequency of data in each physical block in the Flash memory within a preset time length, and then determines whether the access frequency corresponding to each physical block is greater than the preset access frequency. If so, the corresponding physical block is determined to be a hot data block, and the hot data in the hot data block is loaded into the cache. Otherwise, the corresponding physical block is determined to be a cold data block, and the cold data in the scanned cold data block is regularly migrated to a new data block. It can be seen that the embodiment of the present application adopts different wear leveling strategies for hot data and cold data. By loading hot data into the cache, it can cope with frequent reading and writing and reduce frequent access to a single physical block. By migrating cold data to a new data block with relatively more erase and write times, the physical block with less erase and write times can be vacated to process hot data, thereby ensuring wear leveling of the cold data blocks. In addition, when a data write request is received, the latest erase and write count of the current physical block is obtained, and the data to be written is written to the physical block corresponding to the minimum value of all the latest erase and write counts. In this way, the wear of each physical block can be dynamically balanced during the write operation. It can be seen that the embodiment of the present application uses both static wear leveling and dynamic wear leveling when performing wear leveling on the Flash memory, and combines the access frequency of the physical block and the hot and cold data classification technology, so as to achieve the purpose of uniform wear and efficient use of the Flash memory storage resources. At the same time, the wear of the Flash memory is reduced, the service life of the Flash memory is extended, the responsiveness and overall performance of the memory are improved, the energy consumption is reduced, and the replacement frequency and maintenance cost of the memory are reduced.

[0067] The present application embodiment discloses a specific wear leveling method, which is applied to Flash memory, see Figure 2As shown, the method includes:

[0068] Step S21: respectively determining the logical blocks corresponding to the physical blocks in the Flash memory, and creating a mapping table based on the correspondence between the logical addresses of the logical blocks and the physical addresses of the physical blocks to obtain an address mapping table.

[0069] In this embodiment, before performing wear leveling, it is necessary to first determine the logical blocks corresponding to each physical block in the Flash memory, and then create a mapping table based on the correspondence between the logical addresses of each logical block and the physical addresses of the physical blocks, thereby obtaining an address mapping table.

[0070] Specifically, the mapping table is created based on the correspondence between the logical address of the logical block and the physical address of the physical block to obtain the address mapping table, which may include: respectively obtaining the logical address of each of the logical blocks; the logical address includes a page number and an offset within the page; based on a preset page size and the logical address, the physical address corresponding to the physical block is calculated, and the physical address is mapped with the corresponding logical address, and the mapped physical address and the corresponding logical address are saved in a preset mapping table to obtain the address mapping table. In this embodiment, the logical address of each logical block is first obtained respectively, wherein the logical address includes a page number (Page Number) and an intra-page offset (Pageoffset). For example, when the page size is 4KB, the intra-page offset occupies the lowest 12 bits of the logical address (because 2^12 =4096), and the remaining high-order part is the page number; then, based on the preset page size (such as 4KB, that is, each page contains 4096 bytes of data) and the above logical address, the physical address of the corresponding physical block is calculated. Specifically, a page table (i.e., page directory) is first created, in which each item corresponds to a logical page and contains a pointer to the physical page, and the pointer is the starting address of a 4KB area in the physical memory. Finally, the physical address is mapped to the corresponding logical address, and the mapped physical address and the corresponding logical address are saved in the preset mapping table, thereby obtaining an address mapping table. It can be understood that when the processor accesses a logical address, it will first use the page number part of the address to find the corresponding entry in the page table, so as to find the starting address of the corresponding physical page, and then add the page offset to the starting address of the physical page to obtain the final physical address. In a specific embodiment, the process of calculating the physical address based on the logical address is as follows: when the logical address is 0x00012345 and the page size is 4KB, the page number is 0x0001 (that is, the highest 20 bits, depending on the total memory size of the system), and the page offset is 0x2345 (the lowest 12 bits). When the entry with page number 0x0001 in the page table points to a starting physical address of 0x80000000, the final physical address is: physical address = 0x80000000 + 0x2345 = 0x80002345. By creating an address mapping table from logical addresses to physical addresses, the mapping table can be directly called to obtain the corresponding physical block address during the wear leveling process of the physical block, so as to perform corresponding wear leveling operations, such as data migration, data block recycling, etc.

[0071] Step S22: respectively configure an erase counter for the physical block corresponding to each physical address in the address mapping table to count the erase times of the corresponding physical block, obtain the latest erase times corresponding to each physical block, and save the latest erase times in the memory and the hard disk in sequence; the erase counter is pre-integrated in the control circuit corresponding to the physical block.

[0072] In this embodiment, after creating an address mapping table based on the correspondence between the logical address of the logical block and the physical address of the physical block, further, erase counters are configured for the physical blocks corresponding to each physical address in the above address mapping table, that is, one physical block corresponds to one erase counter, wherein the erase counter is pre-integrated in the control circuit of the corresponding physical block, and the erase counter can be used to perform real-time statistics on the number of erases of the corresponding physical block to obtain the latest number of erases corresponding to each physical block, and then the latest number of erases is saved in the memory and the hard disk in sequence.

[0073] Furthermore, a user interface may be provided for the Flash memory, so that an administrator can query and monitor the count value of the erase counter through the interface, so as to facilitate equipment maintenance and fault prediction.

[0074] It should be noted that when the erase / write counter detects that a physical block has been erased or written, the erase / write counter will automatically update the count value of the erase / write counter corresponding to the physical block that has been erased or written.

[0075] In addition, when the system starts, the address mapping table needs to be initialized, and the count value of the erase counter corresponding to each physical block in the address mapping table needs to be initialized, so as to facilitate the subsequent real-time tracking of the erase times according to the physical address.

[0076] Correspondingly, when a data write request is received, the erasure count of each physical block is obtained, and the latest erasure count corresponding to each physical block is obtained. Specifically, it may include: when a data write request is received, the erasure count of each physical block in the current Flash memory is obtained from the memory or the hard disk, and the latest erasure count corresponding to each physical block is obtained. In this embodiment, when a data write request is received, it can be first determined whether the erasure count of each physical block in the current Flash memory exists in the memory. If so, it is directly obtained from the memory. If not, the erasure count of each physical block in the current Flash memory is obtained from the hard disk, and the latest erasure count corresponding to each physical block is obtained.

[0077] In this embodiment, saving the latest number of erase and write times in the memory and the hard disk in sequence may specifically include: using a hash table data structure to record the latest number of erase and write times corresponding to all the physical blocks to obtain hash table structure data; and saving the hash table structure data in the memory and the hard disk in sequence according to a second preset period. In this embodiment, when recording the latest number of erase and write times corresponding to each physical block, a hash table (i.e., hash table) data structure is used. This structure is a data structure that is directly accessed based on a key value. Then, the hash table structure data is saved in the memory and the hard disk in sequence according to a second preset period (T2), that is, first saved in the memory and then saved in the hardware. The latest number of erase and write times corresponding to each physical block is recorded by means of a hash table data structure, which facilitates unified data management, can quickly locate a data block based on the key value, and find the latest number of erase and write times of the physical block. Furthermore, by saving the latest number of erase and write times of each physical block in the memory, the corresponding latest number of erase and write times can be quickly found locally without obtaining it from an external device. In addition, by saving the latest number of erase and write times of each physical block in the hardware, long-term storage can be achieved, thereby avoiding data loss.

[0078] In addition, in order to prevent the loss of information in the erase counter due to unexpected power outages or other failures, the count value of the erase counter can be regularly backed up to non-volatile storage, and when the system is restarted, the count value of the erase counter can be quickly restored through the information in the non-volatile storage, thereby ensuring the integrity and consistency of the data.

[0079] In this embodiment, the wear leveling method may further include: real-time monitoring of the count value of the erase counter corresponding to each physical block in the Flash memory to obtain the erase count value corresponding to each physical block; respectively judging whether the difference between the erase count value corresponding to each physical block and the maximum erase count is within a preset range; if the difference between the erase count value corresponding to the physical block and the maximum erase count is within the preset range, the physical block within the preset range is judged as a high-wear data block, and the data in the high-wear data block is migrated to a second data block; wherein the erase count of the second data block is less than a second erase count threshold, and the second erase count threshold is less than the first erase count threshold; if the difference between the erase count value corresponding to the physical block and the maximum erase count is not within the preset range, the physical block not within the preset range is judged as a low-wear data block; the second data block belongs to the low-wear data block. In this embodiment, it is also necessary to monitor the count value of the erase counter corresponding to each physical block in the Flash memory in real time, so as to obtain the erase count value corresponding to each physical block, and then judge whether the difference between the erase count value corresponding to each physical block and the maximum erase count is within a preset range, that is, whether it is close to the maximum erase count. If the difference between the two is within the preset range, that is, the erase count value of the current data block is close to the maximum erase count, the physical block within the above preset range is determined as a high-wear data block, and the data in the high-wear data block is migrated to the second data block; it should be noted that the erase count of the second data block is less than the second erase count threshold, and the second erase count threshold is less than the first erase count threshold; if the difference between the two is within the preset range, the physical block not within the above preset range is determined as a low-wear data block; wherein the second data block belongs to the low-wear data block. That is, the data in the high-wear data block is migrated to the low-wear data block. In this way, the physical blocks with high write frequency will reduce write scheduling in the future, thereby achieving the purpose of balanced wear of different data blocks. By migrating data from the high-wear area to the low-wear area, premature failure of some physical blocks can also be avoided.

[0080] In addition, when approaching the maximum number of erase and write times, measures can be taken in advance, such as reserving redundant space for corresponding data blocks, thereby preventing data loss.

[0081] Step S23: acquiring the access frequency of the data in each physical block of the Flash memory within a preset time period, and obtaining the target access frequency corresponding to each physical block.

[0082] Step S24: determining respectively whether the target access frequency corresponding to each of the physical blocks is greater than a preset access frequency.

[0083] Step S25: If the target access frequency corresponding to the physical block is greater than the preset access frequency, the physical block with a frequency greater than the preset access frequency is determined to be a hot data block, and hot data in the hot data block is loaded into the cache.

[0084] Step S26: If the target access frequency corresponding to the physical block is not greater than the preset access frequency, the physical block with an access frequency not greater than the preset access frequency is determined to be a cold data block, and the cold data block is scanned according to a first preset period, and the cold data in the scanned cold data block is migrated to the first data block; the number of erase and write times of the first data block is greater than a first erase and write time threshold.

[0085] Step S27: When a data write request is received, the current erase and write counts of each physical block are obtained, the latest erase and write counts corresponding to each physical block are obtained, and the minimum value of all the latest erase and write counts is determined to obtain the minimum erase and write count, and then the data to be written is written to the physical block corresponding to the minimum erase and write count.

[0086] Furthermore, after writing the data to be written into the physical block corresponding to the minimum erase / write times, the method may further include: updating the address mapping table and the count value of the erase / write counter of the physical block corresponding to the minimum erase / write times after the writing is completed. That is, after writing the data to be written into the physical block corresponding to the minimum erase / write times, the address mapping table is updated and the new erase / write times are recorded, so that the physical block corresponding to the minimum erase / write times can be searched again when writing data next time, so as to realize wear leveling of all data blocks.

[0087] In addition, every time a physical block completes an erase or write operation, the count value of its erase counter will be incremented immediately. This update process can be an atomic operation, thereby preventing inconsistencies in the count value of the counter in a high-concurrency environment. Real-time updating of the erase count can also help extend the service life of the Flash memory, ensure data security and system stability. By accurately tracking and managing the erase count, the Flash memory can achieve more efficient resource allocation and a longer service cycle.

[0088] For more specific processing procedures of the above steps S23 to S27, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described again here.

[0089] It can be seen that the embodiment of the present application first determines the logical blocks corresponding to each physical block in the Flash memory respectively, and creates a mapping table based on the correspondence between the logical address of the logical block and the physical address of the physical block to obtain an address mapping table, and then configures an erase counter for the physical block corresponding to each physical address in the address mapping table to count the erase times corresponding to the physical block respectively, obtain the latest erase times corresponding to each physical block, and save the latest erase times in the memory and the hard disk in sequence, then obtains the access frequency of the data in each physical block of the Flash memory within a preset time length, and divides the physical blocks into hot data blocks and cold data blocks according to the relationship between the access frequency and the preset access frequency, and adopts different data migration methods according to the type of data block, and writes the current data to be written to the physical block corresponding to the minimum erase time. The embodiment of the present application manages the physical address of the physical block through an address mapping table, and records the number of erases and writes of different physical blocks through an erase counter. At the same time, it combines a static wear leveling mechanism and a dynamic wear leveling mechanism, classifies hot and cold data according to the access frequency of the physical block, and adopts different wear leveling strategies, so as to achieve the purpose of uniform wear and efficient use of storage resources, and reduce unnecessary erase operations, optimize the utilization efficiency of storage resources, thereby reducing the power consumption of the Flash memory and extending the service life of the battery and the Flash memory; in addition, it reduces the complexity of management and troubleshooting, reduces the replacement frequency and maintenance cost of the Flash memory, and, under the premise of ensuring data security, accelerates the data writing speed, reduces delays, improves the responsiveness and overall performance of the Flash memory, and can meet different application requirements from large-scale storage in data centers to small-capacity storage in mobile devices.

[0090] Correspondingly, the embodiment of the present application also discloses a wear leveling device, which is applied to a Flash memory, see Figure 3 As shown, the device comprises:

[0091] The frequency acquisition module 11 is used to acquire the access frequency of the data in each physical block of the Flash memory within a preset time length, and obtain the target access frequency corresponding to each physical block;

[0092] A judging module 12, used to respectively judge whether the target access frequency corresponding to each of the physical blocks is greater than a preset access frequency;

[0093] A first determination module 13 is configured to determine that the physical block having a target access frequency greater than the preset access frequency is a hot data block if the target access frequency corresponding to the physical block is greater than the preset access frequency;

[0094] A loading module 14, used for loading the hot data in the hot data block into the cache;

[0095] A second determination module 15 is configured to determine that the physical block with a target access frequency not greater than the preset access frequency is a cold data block if the target access frequency corresponding to the physical block is not greater than the preset access frequency;

[0096] The scanning and migration module 16 is used to scan the cold data block according to a first preset period, and migrate the cold data in the scanned cold data block to the first data block; the erasure number of the first data block is greater than the first erasure number threshold;

[0097] The erase / write count acquisition module 17 is used to acquire the erase / write count of each of the current physical blocks when receiving a data write request, and obtain the latest erase / write count corresponding to each of the physical blocks;

[0098] The data writing module 18 is used to determine the minimum value of all the latest erasing times to obtain the minimum erasing times, and then write the data to be written into the physical block corresponding to the minimum erasing times.

[0099] Among them, the specific working processes of the above-mentioned modules can refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0100] It can be seen that in the embodiment of the present application, the access frequency of the data in each physical block of the Flash memory within a preset time length is first obtained to obtain the target access frequency corresponding to each physical block, and then it is determined whether the target access frequency corresponding to each physical block is greater than the preset access frequency. If the target access frequency corresponding to the physical block is greater than the preset access frequency, the physical block greater than the preset access frequency is determined to be a hot data block, and the hot data in the hot data block is loaded into the cache; if the target access frequency corresponding to the physical block is not greater than the preset access frequency, the physical block less than the preset access frequency is determined to be a cold data block, and the cold data block is scanned according to a first preset period, and the cold data in the scanned cold data block is migrated to the first data block; the number of erasures and writes of the first data block is greater than the first erasure and write count threshold; when a data write request is received, the number of erasures and writes of the current physical blocks is obtained, the latest number of erasures and writes corresponding to each physical block is obtained, and the minimum value of all the latest number of erasures and writes is determined to obtain the minimum number of erasures and writes, and then the data to be written is written to the physical block corresponding to the minimum number of erasures and writes. The embodiment of the present application first obtains the access frequency of data in each physical block in the Flash memory within a preset time length, and then determines whether the access frequency corresponding to each physical block is greater than the preset access frequency. If so, the corresponding physical block is determined to be a hot data block, and the hot data in the hot data block is loaded into the cache. Otherwise, the corresponding physical block is determined to be a cold data block, and the cold data in the scanned cold data block is regularly migrated to a new data block. It can be seen that the present application adopts different wear leveling strategies for hot data and cold data. By loading hot data into the cache, it can cope with frequent reading and writing and reduce frequent access to a single physical block. By migrating cold data to a new data block with relatively more erase and write times, the physical block with less erase and write times can be vacated to process hot data, thereby ensuring wear leveling of the cold data blocks. In addition, when a data write request is received, the latest erase and write count of the current physical block is obtained, and the data to be written is written to the physical block corresponding to the minimum value of all the latest erase and write counts. In this way, the wear of each physical block can be dynamically balanced during the write operation. It can be seen that the embodiment of the present application uses both static wear leveling and dynamic wear leveling when performing wear leveling on the Flash memory, and combines the access frequency of the physical block and the hot and cold data classification technology, so as to achieve the purpose of uniform wear and efficient use of the Flash memory storage resources. At the same time, the wear of the Flash memory is reduced, the service life of the Flash memory is extended, the responsiveness and overall performance of the memory are improved, the energy consumption is reduced, and the replacement frequency and maintenance cost of the memory are reduced.

[0101] In some specific embodiments, the wear leveling device may further include:

[0102] A logic block determination unit, used to respectively determine the logic blocks corresponding to the physical blocks in the Flash memory;

[0103] A mapping table creating unit, configured to create a mapping table based on the correspondence between the logical address of the logical block and the physical address of the physical block, so as to obtain an address mapping table;

[0104] A counter configuration unit is used to configure an erase counter for each physical block corresponding to each physical address in the address mapping table, so as to count the erase times of the corresponding physical block, obtain the latest erase times corresponding to each physical block, and save the latest erase times in the memory and the hard disk in sequence; the erase counter is pre-integrated in the control circuit corresponding to the physical block.

[0105] In some specific embodiments, the mapping table creating unit may specifically include:

[0106] A logical address acquisition unit, used to respectively acquire the logical address of each of the logical blocks; the logical address includes a page number and an offset within the page;

[0107] A physical address calculation unit, used for calculating a physical address corresponding to the physical block based on a preset page size and the logical address;

[0108] An address mapping unit, used for mapping the physical address with the corresponding logical address;

[0109] The address storage unit is used to store the mapped physical address and the corresponding logical address into a preset mapping table to obtain an address mapping table.

[0110] In some specific embodiments, the counter configuration unit may specifically include:

[0111] A recording unit, used for recording the latest number of erasures and writes corresponding to all the physical blocks by using a hash table data structure to obtain hash table structure data;

[0112] The data storage unit is used to save the hash table structure data in the memory and the hard disk in sequence according to the second preset period.

[0113] In some specific embodiments, the erase and write times acquisition module 17 may specifically include:

[0114] The erasure number acquisition unit is used to acquire the erasure number of each physical block in the current Flash memory from the memory or hard disk when receiving a data write request, and obtain the latest erasure number corresponding to each physical block.

[0115] In some specific embodiments, the wear leveling device may further include:

[0116] A monitoring unit, used for monitoring the count value of the erase / write counter corresponding to each physical block in the Flash memory in real time, and obtaining the erase / write count value corresponding to each physical block;

[0117] A judging unit, used to judge whether the difference between the erase count value corresponding to each physical block and the maximum erase count is within a preset range;

[0118] a data migration unit, configured to determine the physical block within the preset range as a high-wear data block if the difference between the erase count value corresponding to the physical block and the maximum erase count is within the preset range, and migrate the data in the high-wear data block to a second data block; wherein the erase count of the second data block is less than a second erase count threshold, and the second erase count threshold is less than the first erase count threshold;

[0119] a determination unit, configured to determine the physical block not within the preset range as a low-wear data block if the difference between the erase count value corresponding to the physical block and the maximum erase count is not within the preset range; the second data block belongs to the low-wear data block;

[0120] Correspondingly, after the data is written into the module 18, the following steps may also be included:

[0121] An updating unit is used to update the address mapping table and the count value of the erasing counter of the physical block corresponding to the minimum erasing number after writing is completed.

[0122] In some specific embodiments, the wear leveling device may further include:

[0123] A scanning unit, used for sequentially scanning each physical block in the Flash memory according to a third preset period to determine the physical block where the data has been deleted;

[0124] The garbage collection unit is used to perform garbage collection on the physical blocks of the deleted data in descending order of the number of erasures.

[0125] Furthermore, the present application also discloses an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be considered as any limitation on the scope of use of the present application.

[0126] Figure 4The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the wear leveling method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0127] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0128] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0129] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the wear leveling method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0130] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the wear leveling method disclosed above. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.

[0131] Furthermore, an embodiment of the present application also discloses a computer program product, including a computer program / instruction, which implements the steps of the wear leveling method disclosed above when executed by a processor.

[0132] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0133] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0134] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0135] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0136] The above is a detailed introduction to a wear leveling method, device, equipment and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A wear leveling method, characterized in that: Applicable to Flash memory, including: Acquire the access frequency of data in each physical block of the Flash memory within a preset time length, and obtain the target access frequency corresponding to each physical block; respectively determining whether a target access frequency corresponding to each of the physical blocks is greater than a preset access frequency; If the target access frequency corresponding to the physical block is greater than the preset access frequency, the physical block with a frequency greater than the preset access frequency is determined to be a hot data block, and hot data in the hot data block is loaded into the cache; If the target access frequency corresponding to the physical block is not greater than the preset access frequency, the physical block with the access frequency not greater than the preset access frequency is determined to be a cold data block, and the cold data block is scanned according to a first preset period, and the cold data in the scanned cold data block is migrated to a first data block; the number of erasure times of the first data block is greater than a first erasure times threshold; When a data write request is received, the current erase and write counts of each physical block are obtained, the latest erase and write counts corresponding to each physical block are obtained, and the minimum value of all the latest erase and write counts is determined to obtain the minimum erase and write count, and then the data to be written is written to the physical block corresponding to the minimum erase and write count.

2. The wear leveling method according to claim 1, characterized in that: Also includes: Determine respectively the logical blocks corresponding to the physical blocks in the Flash memory, and create a mapping table based on the correspondence between the logical addresses of the logical blocks and the physical addresses of the physical blocks to obtain an address mapping table; An erase counter is configured for each physical block corresponding to each physical address in the address mapping table to count the erase times of the corresponding physical block, obtain the latest erase times corresponding to each physical block, and save the latest erase times in the memory and the hard disk in sequence; the erase counter is pre-integrated in the control circuit corresponding to the physical block.

3. The wear leveling method according to claim 2, characterized in that: The creating a mapping table based on the correspondence between the logical address of the logical block and the physical address of the physical block to obtain the address mapping table includes: respectively obtaining the logical address of each of the logical blocks; the logical address includes a page number and an offset within the page; The physical address corresponding to the physical block is calculated based on the preset page size and the logical address, and the physical address is mapped with the corresponding logical address, and the mapped physical address and the corresponding logical address are saved in a preset mapping table to obtain an address mapping table.

4. The wear leveling method according to claim 2, characterized in that: The step of sequentially saving the latest number of erasures and writes to the memory and the hard disk includes: Using a hash table data structure to record the latest number of erase and write times corresponding to all the physical blocks to obtain hash table structure data; The hash table structure data is sequentially saved in the memory and the hard disk according to a second preset period.

5. The wear leveling method according to claim 2, characterized in that: When a data write request is received, obtaining the current erasure count of each physical block and obtaining the latest erasure count corresponding to each physical block includes: When a data write request is received, the erasing and writing times of each physical block in the current Flash memory are obtained from the memory or the hard disk to obtain the latest erasing and writing times corresponding to each physical block.

6. The wear leveling method according to claim 5, characterized in that: Also includes: Monitor the count value of the erase / write counter corresponding to each physical block in the Flash memory in real time to obtain the erase / write count value corresponding to each physical block; respectively determining whether the difference between the erase count value corresponding to each of the physical blocks and the maximum erase count is within a preset range; If the difference between the erase count value corresponding to the physical block and the maximum erase count is within the preset range, the physical block within the preset range is determined as a high-wear data block, and data in the high-wear data block is migrated to a second data block; wherein the erase count of the second data block is less than a second erase count threshold, and the second erase count threshold is less than the first erase count threshold; If the difference between the erase count value corresponding to the physical block and the maximum erase count is not within the preset range, the physical block not within the preset range is determined as a low-wear data block; the second data block belongs to the low-wear data block; Correspondingly, after writing the data to be written into the physical block corresponding to the minimum erasing number, the method further includes: After writing is completed, the address mapping table and the count value of the erase counter of the physical block corresponding to the minimum erase number are updated.

7. The wear leveling method according to any one of claims 1 to 6, characterized in that: Also includes: The physical blocks in the Flash memory are scanned in sequence according to a third preset cycle to determine the physical blocks from which data has been deleted, and garbage collection is performed on the physical blocks from which data has been deleted in descending order of the number of erase and write times.

8. A wear leveling device, characterized in that: Applicable to Flash memory, including: A frequency acquisition module, used to acquire the access frequency of data in each physical block of the Flash memory within a preset time length, and obtain a target access frequency corresponding to each physical block; A judging module, used for judging whether the target access frequency corresponding to each of the physical blocks is greater than a preset access frequency; A first determination module, configured to determine that the physical block having a target access frequency greater than the preset access frequency is a hot data block if the target access frequency corresponding to the physical block is greater than the preset access frequency; A loading module, used for loading the hot data in the hot data block into a cache; A second determination module, configured to determine that the physical block with a target access frequency not greater than the preset access frequency is a cold data block if the target access frequency corresponding to the physical block is not greater than the preset access frequency; A scanning and migration module, configured to scan the cold data block according to a first preset period, and migrate the cold data in the scanned cold data block to a first data block; the erasure number of the first data block is greater than a first erasure number threshold; The erase and write count acquisition module is used to acquire the erase and write count of each of the current physical blocks when receiving a data write request, and obtain the latest erase and write count corresponding to each of the physical blocks; The data writing module is used to determine the minimum value of all the latest erasing times to obtain the minimum erasing times, and then write the data to be written into the physical block corresponding to the minimum erasing times.

9. An electronic device, characterized in that: It comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the wear leveling method as claimed in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: Used to store a computer program; wherein, when the computer program is executed by a processor, the wear leveling method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Data storage method and system for solid state disk

    CN120469648A

  • Data storage method, device and equipment of human-computer interface, medium and product

    CN120508250A

  • SSD wear leveling method and device based on dynamic data migration and medium

    CN120596011A

  • Storage medium wear leveling system based on cold and hot data perception

    CN120743186A

  • Layered wear leveling intelligent migration method for adaptive compression of flash memory

    CN122411868A