Wear leveling method, device, equipment and readable storage medium

文档序号:7128 发布日期:2021-09-17 浏览:29次 中文

1. A method of wear leveling, comprising:

acquiring the average erasing times of the minimum erasing unit in each SLUN; wherein the SLUN is a set of a plurality of LUNs;

selecting a first SLUN and a second SLUN which meet a preset wear leveling condition from the SLUNs by using the average erasing times;

and carrying out data transfer and space exchange processing on the first SLUN and the second SLUN.

2. The wear leveling method of claim 1, wherein selecting a first SLUN and a second SLUN from the SLUNs that satisfy a preset wear leveling condition using the average number of erasures comprises:

selecting a maximum average erasing number and a minimum average erasing number from the average erasing numbers;

and under the condition that the difference value between the maximum average erasing times and the minimum average erasing times is larger than a preset erasing threshold value, determining the SLUN corresponding to the maximum average erasing times as the first SLUN, and determining the SLUN corresponding to the minimum average erasing times as the second SLUN.

3. The wear leveling method of claim 1, wherein performing data movement and space exchange processing on the first SLUN and the second SLUN comprises:

copying the data stored by the first SLUN to a reserved SLUN;

copying the data stored by the second SLUN to the first SLUN;

copying the data stored by the reserved SLUN to the second SLUN;

and performing space exchange processing on the first SLUN and the second SLUN.

4. The wear leveling method of claim 1, wherein performing data movement and space exchange processing on the first SLUN and the second SLUN comprises:

monitoring the data writing amount of the first SLUN and the second SLUN;

under the condition that the data writing quantity of the first SLUN is lower than a preset threshold value, carrying out data transfer and space exchange processing on the first SLUN and a reserved SLUN;

after the first SLUN and the reserved SLUN carry out data transfer and space exchange processing, if the data writing quantity of the second SLUN is lower than the preset threshold value, carrying out data transfer and space exchange processing on the second SLUN and the reserved SLUN.

5. The wear leveling method of claim 4, wherein data moving the first SLUN and reserved SLUNs comprises:

and carrying out data transfer on the first SLUN and the reserved SLUN according to a transfer rate in which the data writing rate corresponding to the first SLUN is in inverse proportion.

6. The wear leveling method of claim 5, wherein data shifting the first SLUN and the reserved SLUN at a shifting rate that is inversely proportional to the data writing rate corresponding to the first SLUN comprises:

judging whether the data writing rate corresponding to the first SLUN is greater than a preset pause threshold value or not;

if so, suspending data transfer of the first SLUN and the reserved SLUN until the data writing rate corresponding to the first SLUN is not greater than the preset suspension threshold;

and if not, carrying out data transfer on the first SLUN and the reserved SLUN according to the transfer rate.

7. The wear leveling method of claim 6, further comprising, in the event data movement of the first SLUN and the reserved SLUN is suspended:

detecting whether a third SLUN exists in the first SLUN and the storage area;

if yes, writing the new user data of the first SLUN into the third SLUN or the reserved SLUN;

and if not, writing the new user data of the first SLUN into the reserved SLUN.

8. A wear leveling device comprising:

the erasing times monitoring module is used for acquiring the average erasing times of the minimum erasing units in each SLUN; wherein the SLUN is a set of a plurality of LUNs;

the wear leveling starting module is used for selecting a first SLUN and a second SLUN which meet preset wear leveling conditions from the SLUNs by using the average erasing times;

and the regional exchange module is used for carrying out data transfer and space exchange processing on the first SLUN and the second SLUN.

9. An electronic device, comprising:

a memory for storing a computer program;

a processor for implementing the steps of the wear leveling method according to any one of claims 1 to 7 when executing the computer program.

10. A readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the wear leveling method according to any one of claims 1 to 7.

Background

With the rapid development of SSD (Solid State Disk) technology, the SSD capacity is becoming larger and larger, the storage device pooling management is a large trend of the current storage system, and the accompanying problem is that when multiple users share one SSD, performance coupling between different users is caused due to the limitation of SSD internal resources.

In order to solve the problem, a concept of partition storage is adopted, that is, an SSD physical space is divided into different areas, different storage areas correspond to different LUNs (physical channels capable of independently performing read-write control, one LUN includes a plurality of blocks, and a Block is a minimum unit erased by Nand), and different users are bound with different storage areas, thereby achieving an effect of performance isolation. However, different areas with separated performance can cause uneven wear of each area due to difference of customer data streams, and the capacity of the SSD is reduced due to early reaching of the end of life of storage particles in a part of areas, and the SSD cannot be used due to reduction to a certain extent.

The scheme of maintaining and managing by taking LUNs as dimensions is provided for wear leveling among different storage areas with isolated performance, but at present, a protection mechanism of raid5 (a storage solution taking storage performance, data security and storage cost into consideration) exists in an SSD (solid state disk), generally, data reading, writing, erasing and other operations are performed by taking Sblock (a stripe of blocks in which blocks form raid5 taking blocks as units) as dimensions, wear leveling is performed by taking LUNs as dimensions, the organization mode of raid5 is destroyed, PE (erasing times) of different blocks in Sblock after moving are different, certain errors are caused for subsequent reading voltage selection (selection of sblck reading voltage needs to be performed by taking PE, standing time and the like of sblck as inputs, and if PE in sblck is different, the deflection voltage reading effect is greatly influenced), and further the reliability of the whole disk is influenced.

And different physical blocks are selected for data exchange to solve the problem of wear balance, and if the selected different physical blocks belong to the interior of the LUNs corresponding to different tenants, the problem of performance interference among the different tenants can be caused.

In summary, how to solve the problems of wear leveling between storage areas and the like without affecting reliability on the premise of ensuring performance isolation between tenants using the SSD is a technical problem that needs to be solved by those skilled in the art.

Disclosure of Invention

The application aims to provide a wear leveling method, a device, equipment and a readable storage medium, wherein the wear is more serious as the erasing times are more, so that a first SLUN and a second SLUN with two preset wear leveling conditions can be selected from the SLUNs based on the average erasing times of each minimum erasing unit in the SLUNs (a set of a plurality of LUNs), data transfer and space exchange are carried out on the first SLUN and the second SLUN, and the wear conditions among the SLUNs can be effectively leveled on the premise of ensuring performance isolation among tenants using an SSD and without influencing reliability.

In order to solve the technical problem, the application provides the following technical scheme:

a storage wear leveling method, comprising:

acquiring the average erasing times of the minimum erasing unit in each SLUN; wherein the SLUN is a set of a plurality of LUNs;

selecting a first SLUN and a second SLUN which meet a preset wear leveling condition from the SLUNs by using the average erasing times;

and carrying out data transfer and space exchange processing on the first SLUN and the second SLUN.

Preferably, selecting a first SLUN and a second SLUN satisfying a preset wear leveling condition from the SLUNs using the average number of times of erasing includes:

selecting a maximum average erasing number and a minimum average erasing number from the average erasing numbers;

and under the condition that the difference value between the maximum average erasing times and the minimum average erasing times is larger than a preset erasing threshold value, determining the SLUN corresponding to the maximum average erasing times as the first SLUN, and determining the SLUN corresponding to the minimum average erasing times as the second SLUN.

Preferably, the data transfer and space exchange processing for the first and second SLUNs includes:

copying the data stored by the first SLUN to a reserved SLUN;

copying the data stored by the second SLUN to the first SLUN;

copying the data stored by the reserved SLUN to the second SLUN;

and performing space exchange processing on the first SLUN and the second SLUN.

Preferably, the data transfer and space exchange processing for the first and second SLUNs includes:

monitoring the data writing amount of the first SLUN and the second SLUN;

under the condition that the data writing quantity of the first SLUN is lower than a preset threshold value, carrying out data transfer and space exchange processing on the first SLUN and a reserved SLUN;

after the first SLUN and the reserved SLUN carry out data transfer and space exchange processing, if the data writing quantity of the second SLUN is lower than the preset threshold value, carrying out data transfer and space exchange processing on the second SLUN and the reserved SLUN.

Preferably, the data transfer between the first SLUN and the reserved SLUN includes:

and carrying out data transfer on the first SLUN and the reserved SLUN according to a transfer rate in which the data writing rate corresponding to the first SLUN is in inverse proportion.

Preferably, the data transfer between the first SLUN and the reserved SLUN according to a transfer rate at which a data writing rate corresponding to the first SLUN is inversely proportional to a transfer rate includes:

judging whether the data writing rate corresponding to the first SLUN is greater than a preset pause threshold value or not;

if so, suspending data transfer of the first SLUN and the reserved SLUN until the data writing rate corresponding to the first SLUN is not greater than the preset suspension threshold;

and if not, carrying out data transfer on the first SLUN and the reserved SLUN according to the transfer rate.

Preferably, when suspending the data transfer between the first SLUN and the reserved SLUN, the method further includes:

detecting whether a third SLUN exists in the first SLUN and the storage area;

if yes, writing the new user data of the first SLUN into the third SLUN or the reserved SLUN;

and if not, writing the new user data of the first SLUN into the reserved SLUN.

A wear leveling device comprising:

the erasing times monitoring module is used for acquiring the average erasing times of the minimum erasing units in each SLUN; wherein the SLUN is a set of a plurality of LUNs;

the wear leveling starting module is used for selecting a first SLUN and a second SLUN which meet preset wear leveling conditions from the SLUNs by using the average erasing times;

and the regional exchange module is used for carrying out data transfer and space exchange processing on the first SLUN and the second SLUN.

An electronic device, comprising:

a memory for storing a computer program;

a processor for implementing the steps of the wear leveling method described above when executing the computer program.

A readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the wear leveling method described above.

By applying the method provided by the embodiment of the application, the average erasing times of the minimum erasing unit in each SLUN is obtained; wherein SLUN is a set of a plurality of LUNs; selecting a first SLUN and a second SLUN which meet a preset wear leveling condition from the SLUNs by using the average erasing times; and carrying out data transfer and space exchange processing on the first SLUN and the second SLUN.

To guarantee performance isolation between multiple tenants, the physical areas of SSDs that require different tenants to operate are completely independent at a particular time. For the SSD, a LUN is a physical concept, and is a set of a group of physical blocks, and in terms of its physical structure, the SSD can independently read, write, and erase the physical blocks within the LUN range, and has independent control lines and data lines. A particular LUN can only belong to one tenant at a particular time. Furthermore, since a single LUN may not meet the capacity requirement of a single tenant, multiple physical LUNs are typically grouped into a set (i.e., a SLUN) for use by a particular tenant.

In consideration of the above, different physical blocks are selected for data exchange, so as to solve the problem of wear leveling, and if the selected different physical blocks belong to the LUNs corresponding to different tenants, the problem of performance interference between the different tenants is caused. Based on this, in the application, with the SLUNs as dimensions, data transfer and space exchange are performed between the SLUNs, so that interference to other tenants is avoided, and the effect of performance isolation is ensured. Specifically, since the more the number of times of erasing, the more the abrasion is, the more serious the degree of abrasion of each SLUN can be evaluated based on the number of times of erasing. By carrying out data transfer and space exchange processing on different SLUNs, the wear conditions among the SLUNs can be effectively balanced. Specifically, the average erasing times of the minimum erasing units in the SLUNs need to be acquired, then two first SLUNs and second SLUNs with preset abrasion balance conditions are selected from the SLUNs based on the average erasing times of the minimum erasing units in the SLUNs, data transfer and space exchange are carried out on the first SLUNs and the second SLUNs, and under the premise that performance isolation among tenants using the SSD is guaranteed and reliability is not affected, abrasion conditions among the SLUNs can be effectively balanced.

Accordingly, embodiments of the present application further provide a wear leveling apparatus, a device, and a readable storage medium corresponding to the wear leveling method, which have the above technical effects and are not described herein again.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments or related technologies of the present application, the drawings needed to be used in the description of the embodiments or related technologies are briefly introduced below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

FIG. 1 is a flow chart of an embodiment of a wear leveling method;

fig. 2 is a schematic diagram illustrating an inter-storage area mode equilibrium boot process in an embodiment of the present application;

fig. 3 is a schematic diagram of NVMe set distribution and reserved space in an embodiment of the present application;

FIG. 4 is a schematic diagram of data migration and space exchange according to an embodiment of the present application;

FIG. 5 is a schematic diagram of an implementation of SLUN data migration and space switching in an embodiment of the present application;

FIG. 6 is a schematic diagram of another SLUN data migration and space switching implementation in the present application;

FIG. 7 is a diagram illustrating a relationship between a data moving rate and a user writing rate in an embodiment of the present application;

FIG. 8 is a schematic structural diagram of a wear leveling device in an embodiment of the present application;

fig. 9 is a schematic structural diagram of an electronic device in an embodiment of the present application;

fig. 10 is a schematic structural diagram of an electronic device in an embodiment of the present application.

Detailed Description

In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

Referring to fig. 1, fig. 1 is a flowchart illustrating a wear leveling method according to an embodiment of the present application, the method including the following steps:

s101, acquiring the average erasing times of the minimum erasing units in each SLUN.

SLUN is a collection of multiple LUNs, which are physical channels capable of independently performing read-write control, and a LUN includes multiple blocks, which are the minimum units for Nand erasing. That is, one SLUN includes a plurality of minimum erase units therein.

And recording the corresponding erasing times of each minimum erasing unit, and averaging the erasing times of each minimum erasing unit in one SLUN to obtain the average erasing times of the minimum erasing units in the SLUN, namely average PE.

And S102, selecting a first SLUN and a second SLUN which meet a preset abrasion balance condition from the SLUNs by using the average erasing times.

One SLUN corresponds to one average erase count. And the larger the number of times of erasure, the more serious the wear is, so the larger the average number of times of erasure of the SLUN, the more serious the wear of the SLUN is.

In order to equalize the wear conditions among different SLUNs, a first SLUN and a second SLUN that satisfy a preset wear leveling condition may be selected from the several SLUNs based on the average number of erasures.

The preset abrasion condition can be specifically that the difference value of the average erasing times is required to be larger than a preset threshold value; or, the SLUNs corresponding to the maximum average erasing times can be directly determined as the first SLUN, and the SLUNs corresponding to the four positions of the minimum average erasing times can be determined as the second SLUN; or, the SLUN with the average erasing times larger than a certain threshold value is determined as the first SLUN, and the SLUN smaller than another threshold value is determined as the second SLUN.

In the present embodiment, the first SLUN and the second SLUN refer to two or two types of SLUNs that satisfy the preset wear leveling condition.

The following is a detailed description of determining the first and second SLUNs based on the average number of times of erasing. That is, the step S102 selects the first SLUN and the second SLUN satisfying the preset wear leveling condition from the SLUNs, and may specifically include:

step one, selecting the maximum average erasing times and the minimum average erasing times from all average erasing times;

and step two, under the condition that the difference value between the maximum average erasing times and the minimum average erasing times is larger than a preset erasing threshold value, determining the SLUN corresponding to the maximum average erasing times as a first SLUN, and determining the SLUN corresponding to the minimum average erasing times as a second SLUN.

For convenience of description, the above three steps will be described in combination.

After the average erase count corresponding to each SLUN is obtained, the average erase counts may be counted to find the maximum average erase count and the minimum average erase count.

The larger the difference in the number of times of erasing, the larger the difference in the degree of wear of the respective two SLUNs is indicated. Therefore, in this embodiment, an erasure threshold may be set in advance, and when it is determined that the difference between the maximum average erasure number and the minimum average erasure number is greater than the preset erasure threshold, it is considered that the difference in wear between the corresponding two SLUNs is equal to the requirement for the equalization processing, so that the SLUN corresponding to the maximum average erasure number may be directly determined as the first SLUN, and the SLUN corresponding to the minimum average erasure number may be determined as the second SLUN. Of course, the SLUN corresponding to the maximum average number of times of erasing may be determined as the second SLUN, and the SLUN corresponding to the minimum average number of times of erasing may be determined as the first SLUN.

Referring to fig. 2, fig. 2 is a schematic diagram illustrating an inter-storage area mode balancing activation process according to an embodiment of the present application. The threshold in fig. 2, i.e., the preset threshold (T1), may be selected to be 1% of the maximum number of times of Nand used by the SSD, for example, 7000 times of Nand maximum number of times of toshiba bics3, and the threshold may be set to 7000 × 1% = 70. Wherein the average PE maximum and minimum SLUNs correspond to the first and second SLUNs.

S103, data transfer and space exchange processing is carried out on the first SLUN and the second SLUN.

In this embodiment, the data transfer is to exchange and transfer data of the first SLUN and the second SLUN. That is, after the data transfer, the second SLUN stores the data of the first SLUN before the data transfer, and the first SLUN stores the data of the second SLUN before the data transfer. In order to realize effective data transfer, data transfer may be performed by a third SLUN, which may be a specially reserved SLUN space or an unused SLUN that is currently idle.

The space exchange processing is to exchange the spaces corresponding to the first and second SLUNs. After the space switch is completed, that is, the first SLUN corresponds to the LUN of the second SLUN before the space switch, and the second SLUN corresponds to the LUN of the first SLUN before the space switch.

Specifically, the step S103 performs data transfer and space exchange processing on the first SLUN and the second SLUN, and may include:

copying data stored by a first SLUN to a reserved SLUN;

copying data stored by the second SLUN to the first SLUN;

copying data stored in the reserved SLUN to a second SLUN;

and step four, carrying out space exchange processing on the first SLUN and the second SLUN.

For convenience of description, the above four steps will be described in combination.

Specifically, the SLUN may be allocated and the space may be reserved with reference to fig. 3. Fig. 3 is a schematic diagram of NVMe set (partition arrangement) distribution and reserved space in the embodiment of the present application, where NVMe set0 corresponds to SLUN0 (specifically including lun0 to lun 15), NVMe set1 corresponds to SLUN1 (specifically including lun16 to lun 31) and SLUN2 (specifically including lun32 to lun 47), … …, and OP space (i.e., reserved SLUN) corresponds to SLUN (specifically including lun to lunn + 15).

After the first SLUN and the second SLUN are determined, the data stored by the first SLUN can be copied to the reserved SLUN, the data stored by the first SLUN has a backup, so that the data stored by the second SLUN can be copied to the first SLUN, and then the data stored by the reserved SLUN is copied to the second SLUN, and thus the data migration of the first SLUN and the second SLUN is completed. After the data migration is completed, the first and second SLUNs may be spatially swapped.

For example, the following steps are carried out: referring to fig. 4, fig. 4 is a schematic diagram of data migration and space exchange according to an embodiment of the present application, and if the SLUN0 is a first SLUN and the SLUN2 is a second SLUN, data migration and space exchange processing can be performed on the SLUN0 and the SLUN2 as indicated by arrows shown in fig. 4.

By applying the method provided by the embodiment of the present application,

acquiring the average erasing times of the minimum erasing unit in each SLUN; wherein SLUN is a set of a plurality of LUNs; selecting a first SLUN and a second SLUN which meet a preset wear leveling condition from the SLUNs by using the average erasing times; and carrying out data transfer and space exchange processing on the first SLUN and the second SLUN.

To guarantee performance isolation between multiple tenants, the physical areas of SSDs that require different tenants to operate are completely independent at a particular time. For the SSD, a LUN is a physical concept, and is a set of a group of physical blocks, and in terms of its physical structure, the SSD can independently read, write, and erase the physical blocks within the LUN range, and has independent control lines and data lines. A particular LUN can only belong to one tenant at a particular time. Furthermore, since a single LUN may not meet the capacity requirement of a single tenant, multiple physical LUNs are typically grouped into a set (i.e., a SLUN) for use by a particular tenant.

In consideration of the above, different physical blocks are selected for data exchange, so as to solve the problem of wear leveling, and if the selected different physical blocks belong to the LUNs corresponding to different tenants, the problem of performance interference between the different tenants is caused. Based on this, in the application, with the SLUNs as dimensions, data transfer and space exchange are performed between the SLUNs, so that interference to other tenants is avoided, and the effect of performance isolation is ensured. Specifically, since the more the number of times of erasing, the more the abrasion is, the more serious the degree of abrasion of each SLUN can be evaluated based on the number of times of erasing. By carrying out data transfer and space exchange processing on different SLUNs, the wear conditions among the SLUNs can be effectively balanced. Specifically, the average erasing times of the minimum erasing units in the SLUNs need to be acquired, then two first SLUNs and second SLUNs with preset abrasion balance conditions are selected from the SLUNs based on the average erasing times of the minimum erasing units in the SLUNs, data transfer and space exchange are carried out on the first SLUNs and the second SLUNs, and under the premise that performance isolation among tenants using the SSD is guaranteed and reliability is not affected, abrasion conditions among the SLUNs can be effectively balanced.

It should be noted that, based on the above embodiments, the embodiments of the present application also provide corresponding improvements. In the preferred/improved embodiment, the same steps as those in the above embodiment or corresponding steps may be referred to each other, and corresponding advantageous effects may also be referred to each other, which are not described in detail in the preferred/improved embodiment herein.

In one embodiment of the present application, in order to avoid the influence on the user data writing due to data migration, step S103 performs data migration and space exchange processing on the first SLUN and the second SLUN, including:

monitoring the data writing amount of a first SLUN and a second SLUN;

step two, under the condition that the data writing quantity of the first SLUN is lower than a preset threshold value, carrying out data transfer and space exchange processing on the first SLUN and the reserved SLUN;

and step three, after the first SLUN and the reserved SLUN carry out data transfer and space exchange processing, if the data writing quantity of the second SLUN is lower than a preset threshold value, carrying out data transfer and space exchange processing on the second SLUN and the reserved SLUN.

For convenience of description, the above three steps will be described in combination.

In order to reduce interference of data transfer to user use, data transfer may be performed with a small data write amount. That is, the data write amounts of the first and second SLUNs may be monitored first. Specifically, the data writing amount may be counted only for a fixed time period, that is, the data writing amount per unit time.

And in the case that the data writing quantity of the first SLUN is lower than the preset threshold value, carrying out data transfer and space exchange processing on the first SLUN and the reserved SLUN. In this case, since the data in the reserved SLUN has no storage meaning, the data of the first SLUN can be directly transferred to the reserved SLUN and then the space exchange process is performed.

For example, the following steps are carried out: referring to fig. 5, fig. 5 is a schematic diagram illustrating an implementation of SLUN data migration and space switching in an embodiment of the present application. Wherein, the timer in fig. 5 and fig. 6 suggests time: 1 second (other values may be used, of course), the threshold (T2) is preset, and 10% of the maximum writing amount in the corresponding timer period (for example, 1 s) is selected, for example, 3000 × 10% =300MB when the maximum writing bandwidth of the disc is 3000 GB/s. Specifically, after the first and second SLUNs are determined, a timer triggering manner may be adopted to trigger data transfer and space exchange to the first SLUN. Counting the write quantity in the counting time interval in the storage area marked with the maximum average PE, then judging whether the data write quantity is lower than a threshold value T2, if not, ending the process, and if so, carrying out data transfer on the SULN of the maximum average PE and the reserved SLUN and exchanging physical space.

After the data transfer and space exchange of the first SLUN are completed, when the data writing quantity of the second SLUN is lower than the preset threshold value, the data transfer and space exchange processing can be carried out on the second SLUN and the reserved SLUN.

For example, the following steps are carried out: referring to fig. 6, fig. 6 is a schematic diagram illustrating another implementation of SLUN data migration and space switching in the present embodiment. Where a is the maximum bandwidth capacity of SLUN, and T2 is the threshold T2 in fig. 5 and 6, which is the write threshold when the storage area is determined to be in the idle state. Specifically, after the first SLUN and the SLUN are determined, after the data transfer and the space exchange corresponding to the first SLUN are completed, the data transfer and the space exchange for the first SLUN may be triggered by using a timer triggering method. Counting the writing quantity in the counting time interval in the storage area marked with the minimum average PE, then judging whether the data writing quantity is lower than a threshold value T2, if not, ending the process, and if so, carrying out data transfer on the SULN of the minimum average PE and the reserved SLUN and exchanging physical space.

It should be noted that, since the current conventional SSD DWPD is generally 1 or 3, and the SSD data write bandwidth of PCIe 3.0 is generally 3GB/s, it is estimated that the write time per day is only a few tenths of a day under the premise that the user uses the SSD normally, so as to evaluate that there is enough time to trigger and complete the SLUN replacement action when the SLUN data migration is needed.

Preferably, the data transfer of the first SLUN and the reserved SLUN in the second step specifically includes: and carrying out data transfer on the first SLUN and the reserved SLUN according to a transfer rate in which the data writing rate corresponding to the first SLUN is in inverse proportion. Referring to fig. 7, fig. 7 is a graph of a relationship between a data transfer rate and a user writing rate in an embodiment of the present application, in which a horizontal axis represents a user writing data amount in a unit time, i.e., a data writing rate, and a vertical axis represents a data transfer data amount in a unit time, i.e., a data transfer rate. Because both data transfer and data write occupy the storage performance, in order to avoid the influence of the data transfer on the data write performance, when the data transfer is performed in the step two, the data transfer can be performed on the first SLUN and the reserved SLUN according to the transfer speed at which the data write quantity corresponding to the first SLUN is in inverse proportion.

Further, when the user writing rate is too large, the data transfer can be stopped to guarantee the user writing efficiency. That is, the method for performing data transfer between a first SLUN and a reserved SLUN at a transfer rate at which a data write rate corresponding to the first SLUN is inversely proportional to a transfer rate includes:

step 1, judging whether the data writing rate corresponding to the first SLUN is greater than a preset pause threshold value or not;

step 2, if yes, pausing the data transfer of the first SLUN and the reserved SLUN until the data writing rate corresponding to the first SLUN is not larger than a preset pause threshold value;

and 3, if not, carrying out data transfer on the first SLUN and the reserved SLUN according to the transfer rate.

Furthermore, when the data transfer of the first SLUN and the reserved SLUN is suspended, whether a third SLUN exists in the first SLUN and the storage area or not can be detected; if yes, writing the new user data of the first SLUN into a third SLUN or reserving the first SLUN; if not, the new user data of the first SLUN is written into the reserved SLUN.

That is, when the user write data pressure increases during the data movement, such as exceeding the threshold T2, the entire migration process is suspended, and during the suspension, subsequent user data writes can be written to other SLUNs (if present, only the replacement SLUN if not present) and replacement SLUNs in the same storage area, and cannot be written inside the marked SLUN until the entire SLUN movement is completed. When the storage area is determined to be free again, the transfer can be continued from the place to which the storage area was transferred last time, and the SLUN switching operation can be completed.

Corresponding to the above method embodiment, the present application embodiment further provides a wear leveling device, and the wear leveling device described below and the wear leveling method described above may be referred to in correspondence with each other.

Referring to fig. 8, the apparatus includes the following modules:

an erase count monitoring module 101, configured to obtain an average erase count of a minimum erase unit in each SLUN; wherein SLUN is a set of a plurality of LUNs;

a wear leveling starting module 102, configured to select, from the SLUNs, a first SLUN and a second SLUN that meet a preset wear leveling condition by using the average number of times of erasing;

and the regional switching module 103 is used for carrying out data transfer and space switching processing on the first SLUN and the second SLUN.

The device provided by the embodiment of the application is applied to obtain the average erasing times of the minimum erasing unit in each SLUN; wherein SLUN is a set of a plurality of LUNs; selecting a first SLUN and a second SLUN which meet a preset wear leveling condition from the SLUNs by using the average erasing times; and carrying out data transfer and space exchange processing on the first SLUN and the second SLUN.

To guarantee performance isolation between multiple tenants, the physical areas of SSDs that require different tenants to operate are completely independent at a particular time. For the SSD, a LUN is a physical concept, and is a set of a group of physical blocks, and in terms of its physical structure, the SSD can independently read, write, and erase the physical blocks within the LUN range, and has independent control lines and data lines. A particular LUN can only belong to one tenant at a particular time. Furthermore, since a single LUN may not meet the capacity requirement of a single tenant, multiple physical LUNs are typically grouped into a set (i.e., a SLUN) for use by a particular tenant.

In consideration of the above, different physical blocks are selected for data exchange, so as to solve the problem of wear leveling, and if the selected different physical blocks belong to the LUNs corresponding to different tenants, the problem of performance interference between the different tenants is caused. Based on this, in the application, with the SLUNs as dimensions, data transfer and space exchange are performed between the SLUNs, so that interference to other tenants is avoided, and the effect of performance isolation is ensured. Specifically, since the more the number of times of erasing, the more the abrasion is, the more serious the degree of abrasion of each SLUN can be evaluated based on the number of times of erasing. By carrying out data transfer and space exchange processing on different SLUNs, the wear conditions among the SLUNs can be effectively balanced. Specifically, the average erasing times of the minimum erasing units in the SLUNs need to be acquired, then two first SLUNs and second SLUNs with preset abrasion balance conditions are selected from the SLUNs based on the average erasing times of the minimum erasing units in the SLUNs, data transfer and space exchange are carried out on the first SLUNs and the second SLUNs, and under the premise that performance isolation among tenants using the SSD is guaranteed and reliability is not affected, abrasion conditions among the SLUNs can be effectively balanced.

In an embodiment of the present application, the wear leveling initiation module 102 is specifically configured to select a maximum average erase count and a minimum average erase count from the average erase counts; and under the condition that the difference value between the maximum average erasing times and the minimum average erasing times is larger than a preset erasing threshold value, determining the SLUN corresponding to the maximum average erasing times as a first SLUN, and determining the SLUN corresponding to the minimum average erasing times as a second SLUN.

In an embodiment of the present application, the regional switching module 103 is specifically configured to copy the data stored by the first SLUN to the reserved SLUN; copying the data stored by the second SLUN to the first SLUN; copying data stored by the reserved SLUN to a second SLUN; and performing space exchange processing on the first SLUN and the second SLUN.

In an embodiment of the present application, the area switching module 103 is specifically configured to monitor data writing amounts of the first SLUN and the second SLUN; under the condition that the data writing quantity of the first SLUN is lower than a preset threshold value, carrying out data transfer and space exchange processing on the first SLUN and the reserved SLUN; and after the first SLUN and the reserved SLUN carry out data transfer and space exchange processing, if the data writing quantity of the second SLUN is lower than a preset threshold value, carrying out data transfer and space exchange processing on the second SLUN and the reserved SLUN.

In an embodiment of the present application, the area switching module 103 is specifically configured to perform data transfer on the first SLUN and the reserved SLUN according to a transfer rate at which a data writing rate corresponding to the first SLUN is inversely proportional to the transfer rate.

In a specific embodiment of the present application, the area switching module 103 is specifically configured to determine whether a data writing rate corresponding to the first SLUN is greater than a preset suspension threshold; if so, suspending data transfer of the first SLUN and the reserved SLUN until the data writing rate corresponding to the first SLUN is not greater than a preset suspension threshold; and if not, carrying out data transfer on the first SLUN and the reserved SLUN according to the transfer rate.

In one embodiment of the present application, the method further includes:

the data writing processing module is used for detecting whether a third SLUN exists in the first SLUN and the storage area or not under the condition that the data transfer of the first SLUN and the reserved SLUN is suspended; if yes, writing the new user data of the first SLUN into a third SLUN or reserving the first SLUN; if not, the new user data of the first SLUN is written into the reserved SLUN.

Corresponding to the above method embodiment, the present application further provides an electronic device, and a piece of electronic device described below and a piece of wear leveling method described above may be referred to in correspondence.

Referring to fig. 9, the electronic device includes:

a memory 332 for storing a computer program;

a processor 322 for implementing the steps of the wear leveling method of the above-described method embodiments when executing the computer program.

Specifically, referring to fig. 10, fig. 10 is a schematic diagram of a specific structure of an electronic device provided in this embodiment, which may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 322 (e.g., one or more processors) and a memory 332, where the memory 332 stores one or more computer applications 342 or data 344. Memory 332 may be, among other things, transient or persistent storage. The program stored in memory 332 may include one or more modules (not shown), each of which may include a sequence of instructions operating on a data processing device. Still further, the central processor 322 may be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the electronic device 301.

The electronic device 301 may also include one or more power sources 326, one or more wired or wireless network interfaces 350, one or more input-output interfaces 358, and/or one or more operating systems 341.

The steps in the wear leveling method described above may be implemented by the structure of the electronic device.

Corresponding to the above method embodiment, the present application further provides a readable storage medium, and a readable storage medium described below and a wear leveling method described above may be referred to in correspondence.

A readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the wear leveling method of the above-mentioned method embodiments.

The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.

Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:打印系统以及打印方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类