Operation method of storage system, storage controller, storage system and storage medium
By using erase count values and hot and cold identification values in solid state drives to screen virtual storage blocks, the balanced data transfer is achieved, and the problem of shortening the life of the solid state drive due to frequent transfer of data just written is solved, extending the service life of the solid state drive and improving the accuracy of data handling.
Patent Information
- Application Number
- CN202311624688.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-28
- Publication Date
- 2025-05-30
AI Technical Summary
The lifespan of a solid-state drive is shortened by frequent transfer of just-written data, resulting in damage to the memory block and shortening its service life.
By obtaining the erase count value and hot and cold identification value of each virtual memory block, the first virtual memory block that data is conveyed out and the second virtual memory block that data is conveyed into, and the data stored in the first virtual memory block is conveyed to the second virtual memory block to achieve wear equalization.
It reduces the possibility of write amplification, extends the service life of the solid-state drive, and improves the accuracy of data transfer in virtual storage blocks.
Smart Images

Figure CN120066383A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of semiconductor chips, and in particular, to an operation method of a storage system, a storage controller, a storage system, and a storage medium. Background Art
[0002] The lifespan of a solid state drive (SSD) depends on the number of erasures of the storage blocks. The number of data writes to each storage block is limited. Continuously writing and erasing the same storage block will more easily cause permanent damage to the storage block, thereby shortening the lifespan of the solid state drive. To avoid this situation, a wear leveling (WL) algorithm is adopted to evenly erase and write all storage blocks. Summary of the Invention
[0003] Embodiments of the present disclosure provide an operation method of a storage system, a storage controller, a storage system, and a storage medium, aiming to improve the problem that the lifespan of a solid state drive is shortened due to moving the just-written data.
[0004] To achieve the above object, the embodiments of the present disclosure adopt the following technical solutions:
[0005] In a first aspect, an operation method of a storage system is provided. The method includes: obtaining an erasure count value and a cold / hot identification value of each virtual storage block, where the cold / hot identification value represents the cold / hot degree of the data stored in the corresponding virtual storage block; determining a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in according to the erasure count value and the cold / hot identification value of each virtual storage block; and moving the data stored in the first virtual storage block to the second virtual storage block.
[0006] The operation method of the storage system provided by the embodiments of the present disclosure uses both the erasure count value and the cold / hot identification value as screening conditions to implement the screening of virtual storage blocks. On the one hand, it avoids the situation of screening out virtual storage blocks storing hot data, thereby reducing the possibility of the occurrence of the write amplification (WA) phenomenon, and further extending the service life of the solid state drive. On the other hand, it can more accurately move cold data from the first virtual storage block to the second virtual storage block, improving the accuracy of moving the data stored in the virtual storage block.
[0007] In some embodiments, obtaining the erasure count value and the cold / hot identification value of each virtual storage block includes: obtaining the erasure count value of each virtual storage block from first data information, where the first data information includes the identifier of the virtual storage block and the erasure count value; and obtaining the cold / hot identification value of each virtual storage block from second data information, where the second data information includes the identifier of the virtual storage block and the cold / hot identification value.
[0008] In some embodiments, the second data information further includes a maximum hot-cold identifier value, which is the maximum value among the hot-cold identifier values. Determining a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved, based on the erase count value and the hot-cold identifier value of each virtual storage block, includes: determining, as the first virtual storage block, a virtual storage block whose erase count value is less than a first threshold and the difference between whose hot-cold identifier value and the maximum hot-cold identifier value is greater than a second threshold; and determining, as the second virtual storage block, a virtual storage block whose erase count value is greater than a third threshold.
[0009] In some embodiments, the method further includes: in response to a data write instruction, writing the data into a third virtual storage block, updating the maximum hot-cold identifier value, and assigning the hot-cold identifier value of the third virtual storage block as the maximum hot-cold identifier value.
[0010] In some embodiments, before writing the data into the third virtual storage block and updating the maximum hot-cold identifier value in response to the data write instruction, the method further includes: determining, as the third virtual storage block, a virtual storage block that is in an idle state and has the minimum erase count value.
[0011] In some embodiments, when the amount of data written is the same, the increment of the maximum hot-cold identifier value is the same.
[0012] In some embodiments, writing the data into the third virtual storage block and updating the maximum hot-cold identifier value includes: determining the data storage mode of the third virtual storage block, where the data storage mode includes a first mode and a second mode, and the storage bit number of the second mode is m times that of the first mode; when the data storage mode of the third virtual storage block is the first mode, increasing the maximum value of the data hot-cold type identifier by a first value; and when the data storage mode of the third virtual storage block is the second mode, increasing the maximum value of the data hot-cold type identifier by a second value, where the second value is m + 1 times the first value.
[0013] In some embodiments, before determining the first virtual storage block from which data is to be moved out and the second virtual storage block into which data is to be moved, the method further includes: determining the relationship between the difference between the maximum and minimum erase count values of the virtual storage blocks and a fourth threshold; and in response to the difference between the maximum and minimum erase count values of the virtual storage blocks being greater than the fourth threshold, determining the first virtual storage block from which data is to be moved out and the second virtual storage block into which data is to be moved.
[0014] In a second aspect, a storage controller is provided, including a buffer configured to store first data information and second data information, where the first data information stores the identifier and erasure count value of a virtual storage block, and the second data information stores the identifier and cold-hot identification value of the virtual storage block. And a processor coupled to the buffer and configured to: obtain the erasure count value and cold-hot identification value of each virtual storage block, where the cold-hot identification value characterizes the cold-hot degree of the data stored in the corresponding virtual storage block, determine a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in according to the erasure count value and cold-hot identification value of each virtual storage block, and move the data stored in the first virtual storage block to the second virtual storage block.
[0015] In some embodiments, the processor is specifically configured to: obtain the erasure count value of each virtual storage block from the first data information and obtain the cold-hot identification value of each virtual storage block from the second data information.
[0016] In some embodiments, the second data information further includes a maximum cold-hot identification value, which is the maximum value among the cold-hot identification values. The processor is specifically configured to: determine a virtual storage block with an erasure count value less than a first threshold and a difference between the cold-hot identification value and the maximum cold-hot identification value greater than a second threshold as the first virtual storage block, and determine a virtual storage block with an erasure count value greater than a third threshold as the second virtual storage block.
[0017] In some embodiments, the storage controller further includes a host interface circuit configured to receive a data write instruction. The processor is further configured to: in response to the data write instruction received by the host interface circuit, write data to a third virtual storage block, update the maximum cold-hot identification value, and assign the cold-hot identification value of the third virtual storage block as the maximum cold-hot identification value.
[0018] In some embodiments, the processor is further configured to: determine a third virtual storage block that is in an idle state and has the smallest erasure count value.
[0019] In some embodiments, the processor is further configured to: when the amount of written data is the same, the increase amount of the maximum cold-hot identification value is the same.
[0020] In some embodiments, the processor is further configured to: determine the data storage mode of the third virtual storage block. The data storage mode includes a first mode and a second mode, where the storage bit number of the second mode is m times that of the first mode. When the data storage mode of the third virtual storage block is the first mode, increase the maximum value of the data cold-hot type identification by a first value. When the data storage mode of the third virtual storage block is the second mode, increase the maximum value of the data cold-hot type identification by a second value, where the second value is m + 1 times the first value.
[0021] In some embodiments, the processor is further configured to: determine the relationship between the difference between the maximum and minimum erase count values of the virtual storage block and a fourth threshold; and in response to the difference between the maximum and minimum erase count values of the virtual storage block being greater than the fourth threshold, determine a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in.
[0022] In a third aspect, a storage system is provided, including: a memory including a plurality of storage blocks, and a storage controller coupled to the memory through a flash interface circuit, the storage controller being configured to: obtain the erase count value and the cold-hot identification value of each virtual storage block, where each virtual storage block includes at least one storage block, and the cold-hot identification value characterizes the cold-hot degree of the data stored in the corresponding virtual storage block; determine a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in according to the erase count value and the cold-hot identification value of each virtual storage block; and move the data stored in the first virtual storage block to the second virtual storage block.
[0023] In some embodiments, first data information and second data information are stored in the storage controller, where the first data information includes the identifier and the erase count value of the virtual storage block, and the second data information includes the identifier and the cold-hot identification value of the virtual storage block. The storage controller is specifically configured to: obtain the erase count value of each virtual storage block from the first data information, and obtain the cold-hot identification value of each virtual storage block from the second data information.
[0024] In some embodiments, the second data information further includes a maximum cold-hot identification value, which is the maximum value among the cold-hot identification values. The storage controller is specifically configured to: determine a virtual storage block with an erase count value less than a first threshold and a difference between the cold-hot identification value and the maximum cold-hot identification value greater than a second threshold as the first virtual storage block, and determine a virtual storage block with an erase count value greater than a third threshold as the second virtual storage block.
[0025] In some embodiments, the storage controller further includes a host interface circuit for connecting to a host. The storage controller is further configured to: in response to a data write instruction received by the host interface circuit, write the data into a third virtual storage block, update the maximum cold-hot identification value, and assign the cold-hot identification value of the third virtual storage block to the maximum cold-hot identification value.
[0026] In some embodiments, the storage controller is further configured to: determine a virtual storage block that is in an idle state and has the minimum erase count value as the third virtual storage block.
[0027] In some embodiments, the storage controller is further configured to: when the amount of written data is the same, the increase amount of the maximum cold-hot identification value is the same.
[0028] In some embodiments, the storage controller is further configured to: determine the data storage mode of a third virtual storage block, where the data storage mode includes a first mode and a second mode, and the number of storage bits in the second mode is m times that in the first mode; when the data storage mode of the third virtual storage block is the first mode, increase the maximum value of the data cold-hot type identifier by a first value; when the data storage mode of the third virtual storage block is the second mode, increase the maximum value of the data cold-hot type identifier by a second value, where the second value is m + 1 times the first value.
[0029] In some embodiments, the storage controller is further configured to: determine the magnitude relationship between the difference between the maximum erasure count value and the minimum erasure count value of a virtual storage block and a fourth threshold; in response to the difference between the maximum erasure count value and the minimum erasure count value of the virtual storage block being greater than the fourth threshold, determine a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in.
[0030] In a fourth aspect, there is provided a computer-readable storage medium storing computer-executable instructions; after the computer-executable instructions are executed, any of the methods in the first aspect described above can be implemented.
[0031] In a fifth aspect, there is provided an electronic device including a host, such as the storage system provided in the third aspect, where the host is connected to the storage system to write data to the storage system or read data stored in the storage system.
[0032] It can be understood that the technical effects of the second aspect to the fifth aspect refer to the technical effects of the first aspect and any of its embodiments, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 Schematic diagram of the electronic device provided by an embodiment of the present disclosure;
[0034] Figure 2 Schematic diagram of the storage system provided by an embodiment of the present disclosure;
[0035] Figure 3 Schematic diagram of another storage system provided by an embodiment of the present disclosure;
[0036] Figure 4 Schematic diagram of the wear process of a virtual storage block provided by an embodiment of the present disclosure;
[0037] Figure 5 Schematic diagram of another wear process of a virtual storage block provided by an embodiment of the present disclosure;
[0038] Figure 6 Schematic diagram of the storage controller provided by an embodiment of the present disclosure;
[0039] Figure 7 Schematic flowchart of the operation method of the storage system provided by the embodiments of the present disclosure;
[0040] Figure 8 Schematic flowchart of another operation method of the storage system provided by the embodiments of the present disclosure;
[0041] Figure 9 Schematic diagram of information storage provided by the embodiments of the present disclosure;
[0042] Figure 10 Schematic flowchart of another operation method of the storage system provided by the embodiments of the present disclosure;
[0043] Figure 11 Schematic diagram of the virtual storage block screening process provided by the embodiments of the present disclosure;
[0044] Figure 12 Schematic diagram of the data recovery process provided by the embodiments of the present disclosure;
[0045] Figure 13 Schematic flowchart of another operation method of the storage system provided by the embodiments of the present disclosure;
[0046] Figure 14 Schematic diagram of the data writing process provided by the embodiments of the present disclosure. Detailed implementation manners
[0047] Next, the technical solutions in some embodiments of the present disclosure will be clearly and completely described in conjunction with the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments provided by the present disclosure, all other embodiments obtained by those of ordinary skill in the art shall fall within the protection scope of the present disclosure.
[0048] Unless otherwise required by the context, the term "including" is interpreted as open and inclusive throughout the specification and claims, that is, "including, but not limited to". In the description of the specification, the terms "one embodiment", "some embodiments", "exemplary embodiments", "exemplarily" or "some examples", etc., are intended to indicate that the specific features, structures, materials or characteristics related to the embodiment or example are included in at least one embodiment or example of the present disclosure. The schematic representations of the above terms are not necessarily referring to the same embodiment or example. In addition, the specific features, structures, materials or characteristics may be included in any one or more embodiments or examples in any appropriate manner.
[0049] Hereinafter, the terms "first" and "second" are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present disclosure, unless otherwise specified, the meaning of "a plurality" is two or more.
[0050] When describing some embodiments, the expression "coupled" and its derivatives may be used. For example, when describing some embodiments, the term "coupled" may be used to indicate that two or more components have direct physical contact or electrical contact. In this case, "coupled" may also be described as "connected". In addition, the term "coupled" may also refer to two or more components that do not have direct contact with each other but still cooperate or interact with each other. The embodiments disclosed herein are not necessarily limited to the content herein.
[0051] "At least one of A, B, and C" has the same meaning as "at least one of A, B, or C", and both include the following combinations of A, B, and C: only A, only B, only C, the combination of A and B, the combination of A and C, the combination of B and C, and the combination of A, B, and C.
[0052] "A and / or B" includes the following three combinations: only A, only B, and the combination of A and B. The use of "suitable for" or "configured to" herein means open and inclusive language, which does not exclude a device suitable for or configured to perform additional tasks or steps. Additionally, the use of "based on" means open and inclusive because a process, step, calculation, or other action "based on" one or more conditions or values may, in practice, be based on additional conditions or values beyond those stated.
[0053] The use of "configured to" herein means open and inclusive language, which does not exclude a device suitable for or configured to perform additional tasks or steps.
[0054] Embodiments of the present disclosure provide an electronic device, which may be, for example, any one of a mobile phone, a desktop computer, a tablet computer, a laptop computer, a server, a vehicle-mounted device, a wearable device (such as a smart watch, a smart bracelet, smart glasses, etc.), a mobile power supply, a game console, a digital multimedia player, etc. Refer to Figure 1 , Figure 1FIG. 0 shows a schematic diagram of an electronic device 10 provided by an embodiment of the present disclosure, including a host 100 and a storage system 110. The host 100 is coupled to the storage system 110 to write data to the storage system 110 or read data stored in the storage system 110. Herein, the host is also called a master device, and the storage system is also called a slave device. In an electronic device, the slave device can be accessed by different master devices. For example, taking the electronic device as a mobile phone, the central processing unit (CPU), digital signal processor (DSP), etc. of the mobile phone can all act as hosts to access the storage system.
[0055] Exemplarily, referring to Figure 2 , Figure 2 FIG. 7 shows a schematic diagram of the storage system 110 provided by an embodiment of the present disclosure. The storage system 110 includes a storage controller 111 and a memory 112. The storage controller 111 is coupled to the memory 112 to control the memory 112 to store data. Herein, the memory 112 can be a two-dimensional (2D) memory or a three-dimensional (3D) memory.
[0056] The storage system 110 can be integrated into various types of storage devices. For example, it can be included in the same package (such as a universal flash storage (UFS) package or an embedded multimedia card (eMMC) package). That is to say, the storage system 110 can be applied to and packaged into different types of electronic products, such as mobile phones (e.g., cell phones), desktop computers, tablet computers, laptop computers, servers, in-vehicle devices, game consoles, printers, positioning devices, wearable devices, smart sensors, mobile power supplies, virtual reality (VR) devices, augmented reality (AR) devices, or any other suitable electronic devices with a memory.
[0057] In some embodiments, the storage system 110 includes a storage controller 111 and a memory 112, and the storage system 110 can be integrated into a memory card. The memory card includes any one of a personal computer memory card international association (PCMCIA) card (abbreviated as PC card), a compact flash (CF) card, a smart media (SM) card, a memory stick, a multi media card (MMC), a secure digital memory card (SD) card, and a UFS.
[0058] In some other embodiments, referring to Figure 3 , the storage system 110 includes a storage controller 111 and multiple memories 112, and the storage system 110 is integrated into a solid state drive (SSD).
[0059] In the storage system 110, in some embodiments, the storage controller 111 is configured to operate in a low duty cycle environment, such as an SD card, a CF card, a universal serial bus (USB) flash drive, or other media used in electronic devices such as personal calculators, digital cameras, mobile phones, etc.
[0060] In some other embodiments, the storage controller 111 is configured to operate in a high duty cycle environment of an SSD or an eMMC, and the SSD or eMMC is used for data storage in mobile devices such as smart phones, tablets, laptops, etc. and enterprise storage arrays.
[0061] In some embodiments, the storage controller 111 can be configured to manage the data stored in the memory 112 and communicate with external devices (such as the host 100). In some embodiments, the storage controller 111 can also be configured to control the operations of the memory 112, such as read, erase, and programming operations. In some embodiments, the storage controller 111 can also be configured to manage various functions regarding the data stored in or to be stored in the memory 112, including at least one of bad block management, garbage collection (GC), logical to physical address conversion, and wear leveling (WL). In some embodiments, the storage controller 111 is also configured to process the error correction code for the data read from or written to the memory 112.
[0062] In addition, the storage controller 111 can communicate with an external device (e.g., the host 100) through at least one of various interface protocols. The interface protocols include at least one of the universal serial bus (USB) protocol, the microsoft management console (MMC) protocol, the peripheral component interconnect (PCI) protocol, the peripheral component interconnect express (PCI-E) protocol, the advanced technology attachment (ATA) protocol, the serial ATA protocol, the parallel ATA protocol, the small computer system interface (SCSI) protocol, the enhanced small disk interface (ESDI) protocol, the integrated drive electronic (IDE) protocol, and the firewire protocol.
[0063] The storage system 110 provided by the present disclosure can be integrated into a solid state drive (SSD). The service life of the solid state drive is a very important concern. To enable the solid state drive to have a longer life cycle, the occurrence of unbalanced erasure can be avoided. Unbalanced erasure refers to the situation where some storage blocks are frequently erased and quickly become bad blocks, while some other storage blocks are rarely erased. The increase in the number of bad blocks leads to a shortening of the overall life cycle of the solid state drive.
[0064] Exemplarily, referring to Figure 4 , the usage of the solid state drive can be divided into several stages according to the usage duration (or the number of erase / write cycles) of the solid state drive. For example Figure 4 the stages 1, 2, and 3 shown in
[0065] When the solid state drive is in stage 1, that is, the usage duration of the solid state drive is short, the number of programming times is small, and the number of erase operations performed is also small. Assume that the erase count (EC) of the virtual blocks (VB) numbered A, B, C, and D is 0 at this stage. The virtual block can include at least one storage block in the memory. For example, the virtual block can be composed of storage blocks with the same physical location on all flash chips in the memory.
[0066] As the usage time of the solid-state drive increases and the number of programming operations continues to grow, the solid-state drive enters stage 2. During this process, the erase count value of the virtual storage block will increase continuously as data is written. However, the probabilities of different virtual storage blocks being used to store newly written data are different, resulting in significant differences in the increased values of the erase count values of different virtual storage blocks. That is, there may be a situation where some virtual storage blocks are frequently used while some are used less frequently.
[0067] For example, when the solid-state drive is in the state of stage 2, the erase count value of the virtual storage block numbered C is much larger than that of the virtual storage blocks numbered B and D, and the erase count values of the virtual storage blocks numbered B and D are much larger than that of the virtual storage block numbered A.
[0068] As the usage time of the solid-state drive further increases and the number of programming operations also continues to increase, the solid-state drive enters stage 3. The virtual storage blocks that were frequently used in stage 2 may continue to be frequently used, eventually resulting in their erase count values becoming too large and becoming bad blocks, exhausting their service life. While those virtual storage blocks with smaller erase count values in stage 2 still have a relatively long service life in stage 3.
[0069] For example, the erase count values of the virtual storage blocks numbered C and D exceed the preset threshold, exhausting their service life and becoming bad blocks, while the erase count values of the virtual storage blocks numbered B and A are also at a relatively high level. It can be seen that in the above scheme, except for the virtual storage blocks numbered A, B, C, and D being in a continuously used state, other virtual storage blocks are in an unused state. There are huge differences in the erase count values of different virtual storage blocks, resulting in a significant decline in the service life and performance of the solid-state drive.
[0070] In order to enable the solid-state drive to have a longer life cycle, in a feasible implementation, a wear leveling algorithm is adopted to solve the above problems. The implementation principle of the wear leveling algorithm is to select a source virtual data block (SVB) and a target virtual data block (TVB) from the virtual storage blocks, and then move the data in the source virtual data block to the target virtual data block, thereby changing the source virtual data block from the used state to the idle state and setting the target virtual data block to the used state. In this way, the source virtual data block in the idle state can be used to store newly written data, while the target virtual data block, since it is set to the used state, will not be used to store newly written data. For the source virtual data block, its selection condition is: the erase count value is less than the preset threshold and it is a virtual data block in the used state. For the target virtual data block, its selection condition is: the erase count value is greater than the preset threshold and it is a virtual data block in the idle state.
[0071] Through the wear leveling algorithm, the probability that a target virtual data block with a larger erase count value continues to be used to store newly written data can be reduced, and the probability that a source virtual data block with a smaller erase count value is used to store newly written data can be increased. The difference between the erase count values of the source virtual data block and the target virtual data block gradually decreases, so that the erase count values of different virtual data blocks are in a balanced state.
[0072] Exemplarily, referring to Figure 5 , in the case of adopting the wear leveling algorithm, when the solid-state drive is in stage 1, that is, when the solid-state drive is in the initial use state, the erase count values of the virtual storage blocks numbered A, B, C, and D are all 0.
[0073] Continuing to refer to Figure 5 , as the solid-state drive is continuously used and the number of programming times increases, the use of the solid-state drive enters stage 2. The erase count values of the virtual storage blocks will continuously increase, but the probabilities that different virtual storage blocks are used to store newly written data are similar, so the increased values of the erase count values of different virtual storage blocks will not have a large difference, that is, the erase count values of all virtual storage blocks are similar. For example, the erase count value of the virtual storage block numbered A is slightly larger than the erase count values of the virtual storage blocks numbered B, C, and D.
[0074] Continuing to refer to Figure 5 , as the number of programming times continues to increase, the use of the solid-state drive enters stage 3, and the erase count values of all virtual storage blocks have the probability of increasing, that is, in addition to the virtual storage blocks numbered A, B, C, and D, the erase count values of the remaining virtual storage blocks are also increasing. For example, the erase count values of the virtual storage blocks numbered A and C are slightly larger than the erase count values of the virtual storage blocks numbered B and D.
[0075] It can be seen that in the above scheme, not only the virtual storage blocks numbered A, B, C, and D are in use, but other virtual storage blocks are also in use, so the situation where the erase count value of an individual virtual storage block exceeds the preset threshold and the life of the virtual storage block is exhausted will not occur. Therefore, by adopting the wear leveling algorithm, the erase count values of different virtual storage blocks can be balanced, thereby improving the service life of the solid-state drive.
[0076] During the process of using the wear leveling algorithm, when the virtual data block storing hot data is selected as the source virtual data block and the hot data stored in the source virtual data is moved to the target virtual data block, due to the movement of the hot data, the erase count value in the target virtual data block may increase abnormally, and the write amplification increases.
[0077] Embodiments of the present disclosure provide a solution: taking each virtual data block as a unit, when a new virtual data block is opened to store newly written data, a cold / hot identification value (hot id) is assigned to each virtual data block, and based on the size of the cold / hot identification value, the cold / hot type of the data stored in the virtual storage block is determined.
[0078] Figure 6 FIG. 4 shows a schematic diagram of a memory controller 111 provided according to an embodiment of the present disclosure. The storage controller 111 may include a processor 211, a host interface circuit 212, a data buffer circuit 213, an error correcting module (Error Correcting Code, ECC) 214, a garbage collection module 215, a wear leveling module 216, and a memory interface circuit 217.
[0079] The processor 211 can communicate with the host 100 through the host interface circuit 212 and perform logical operations to control the operation of the storage controller 111. For example, the processor 211 can load programming commands, data files, or data structures in response to requests received from the host 100 or an external device, perform various operations, or generate commands and addresses. For example, the processor 211 can generate various commands for performing programming operations, read operations, erase operations, and parameter setting operations. In some possible examples, the processor 211 can generate commands without a request from the host 100. For example, the processor 211 can generate commands for background operations such as garbage collection of the memory 112.
[0080] The error correction module 214 can perform error detection and correction functions on the read data read from the memory 112. For example, the error correction module 214 can generate parity bits for the write data to be written to the memory 112, and the generated parity bits can be stored in the memory 112 together with the write data. When reading data from the memory 112, the error correction module 214 can use the parity bits read from the memory 112 together with the read data to correct the errors in the read data and can output the error-corrected read data.
[0081] The host interface circuit 212 can send data or commands to the host 100, or receive data or commands from the host 100. For example, instructions sent from the host 100 to the host interface circuit 212, data to be written to the memory 112, etc., and responses to the instructions sent from the host interface circuit 212 to the host 100, data to be read from the memory 112, etc. The host interface circuit 212 can also include a protocol for exchanging data between the host 100 and the storage controller 111. For example, the host interface circuit 212 can communicate with the host 100 through at least one of various interface protocols such as: Universal Serial Bus protocol, Microsoft Management Console protocol, Peripheral Component Interconnect protocol, PCI Express protocol, Advanced Technology Attachment protocol, Serial ATA protocol, Parallel ATA protocol, Small Computer System Interface protocol, Enhanced Small Disk Interface protocol, Integrated Drive Electronics protocol, FireWire protocol, etc.
[0082] The memory interface circuit 217 can communicate with the memory 112 according to the control of the processor 211 using a communication protocol, including the communication of commands, addresses, and data. The memory interface circuit 217 can send data to be written to the memory 112 to the memory 112, or can receive data read from the memory 112. The memory interface circuit 217 can be implemented to conform to a standard protocol such as Toggle or Open NAND Flash Interface (ONFI). Exemplarily, taking the ONFI protocol as an example, the storage controller 111 and the memory 112 can be connected through the ONFI bus.
[0083] Specifically, when the above-mentioned processor 211 is working, it executes the operation method as Figure 7 shown. This operation method includes S10 to S30, and the processor 211 can execute the operation method including S10 to S30.
[0084] In S10, obtain the erase count value and the hot / cold identification value of each virtual storage block.
[0085] The processor monitors each virtual storage block through an erase count table (ECT), searches for the virtual storage block with the smallest erase count value in the data block pool, and the virtual storage block with the largest erase count value in the free block pool. The data block pool can be composed of virtual storage blocks storing valid data, that is, the data block pool is composed of virtual storage blocks in a non-idle state. The free block pool can be composed of virtual storage blocks not storing valid data, that is, the free block pool is composed of virtual storage blocks in an idle state.
[0086] After obtaining the erase count value of each virtual storage block, it is determined whether the trigger condition for the data migration operation is satisfied.
[0087] In a feasible implementation, determine the magnitude relationship between the difference between the maximum and minimum erasure count values of the virtual storage block and the fourth threshold. In response to the difference between the maximum and minimum erasure count values of the virtual storage block being greater than the fourth threshold, determine the first virtual storage block for data evacuation and the second virtual storage block for data relocation.
[0088] Exemplarily, subtract the minimum erasure count value in the free pool from the maximum erasure count value in the data block pool. If the minimum and maximum erasure count values satisfy the relationship corresponding to Formula 1, a data migration operation can be triggered.
[0089] EC min used VB <EC max free VB –EC gap TH (1)
[0090] In the formula, EC min used VB represents the erasure count value of the data block with the minimum erasure count value in the data block pool, and EC max free VB represents the erasure count value of the data block with the maximum erasure count value in the free pool, and EC gap TH represents the preset fourth threshold.
[0091] After the data migration operation is triggered, filter the virtual data blocks for data relocation and the virtual data blocks for data evacuation according to the erasure count value and cold / hot identification value of each virtual storage block.
[0092] In a solid-state drive, each time a new virtual storage block is to be opened, the virtual storage block may first be erased and then new data may be written. The erasure count value is a value that records the number of times each virtual storage block is erased. The magnitude of the erasure count value can be used to characterize the lifespan of the virtual storage block. The smaller the erasure count value, the fewer times the virtual storage block has been used, so the lifespan of the virtual storage block is relatively long. Conversely, the larger the erasure count value, the more times the virtual storage block has been used, so the lifespan of the virtual storage block is relatively short. The magnitude of the cold / hot identification value can be continuously accumulated as the number of data writes increases. Therefore, the cold / hot degree of the data stored in the virtual storage block can be judged according to the difference relationship between the cold / hot identification value and the preset threshold.
[0093] In S20, determine the first virtual storage block for data evacuation and the second virtual storage block for data relocation according to the erasure count value and cold / hot identification value of each virtual storage block.
[0094] The first virtual storage block can be the source virtual data block in the wear leveling algorithm, and the second virtual storage block can be the target virtual data block in the wear leveling algorithm. After obtaining the erase count value and the cold / hot identification value of each virtual storage block, the erase count value and the cold / hot identification value are jointly used as the screening conditions, and then the first virtual storage block and the second virtual storage block are respectively screened out from the data block pool and the free pool. The target virtual data block is selected to receive the data from the source virtual data block to achieve wear leveling between the virtual data blocks. The first virtual storage block and the second virtual storage block are located in different pools. The first virtual storage block belongs to the data block pool, while the second virtual storage block is located in the free pool. When screening the first virtual storage block, the screening can be jointly performed according to the magnitude relationship between the erase count value and the preset threshold, and the magnitude relationship between the difference between the cold / hot identification value and the maximum cold / hot identification value and the preset threshold. When screening the second virtual storage block, the screening can be performed according to the magnitude relationship between the erase count value and the preset threshold.
[0095] In S30, the data stored in the first virtual storage block is transferred to the second virtual storage block.
[0096] Data transfer refers to the process of copying and partitioning the stored data in the first virtual storage block into the second virtual storage block. This can be achieved through data transfer methods such as physical data copying and logical data movement. By transferring data from the virtual storage block with lower wear (the first virtual storage block) to the virtual storage block with higher wear (the second virtual storage block), the usage of different virtual storage blocks on the device can be balanced. When performing data transfer, in order to ensure data consistency and integrity. That is, the data should not be lost or damaged during the copying or moving process, and after the transfer is completed, the first virtual storage block can be erased and partitioned into the free pool. Since the second virtual storage block already stores data, the second virtual storage block can be partitioned into the data block pool.
[0097] In the present disclosure, screening the source virtual data block based on the erase count value and the cold / hot identification value reduces the possibility of transferring the hot data stored in the virtual data block. The cold / hot type of the data can be accurately distinguished through the cold / hot identification value, thereby reducing the possibility that the erase count value of the virtual data block with a larger erase count value invalidly increases due to storing the newly written hot data, and prolonging the service life of the solid-state drive.
[0098] Refer to Figure 8 , in a possible implementation manner, when obtaining the erase count value and the cold / hot identification value of each virtual storage block, S10 may include the following methods.
[0099] S101: Obtain the erase count value of each virtual storage block from the first data information.
[0100] The first data information is a data set containing the erase count values of all virtual storage blocks. The first data information can be stored in the buffer of the memory controller and then backed up to the memory regularly. For example, the first data information can be an erase count table, which records the erase count values of all virtual storage blocks. The erase count table is a data structure in the storage system used to track the number of erase operations for each virtual storage block. The erase count table is used to manage and monitor the lifespan and health status of the storage blocks. Each entry in the erase count table is associated with a virtual storage block and records the erase count value of that virtual storage block. The erase count table is updated in real time, that is, every time an erase operation is performed on a virtual storage block, the erase count value of the corresponding virtual storage block is incremented.
[0101] Exemplarily, referring to FIG. 9, in Figure 9 the first data information shown on the left, VBα represents the virtual storage block identifier, and ECα represents the erase count value of the virtual storage block. That is, the erase count value of VB1 is EC1, the erase count value of VB2 is EC2, and so on. Therefore, by indexing with the identifier of the virtual storage block and traversing the first data information, the erase count value corresponding to each virtual storage block can be obtained.
[0102] S102: Obtain the hot / cold identification values of each virtual storage block from the second data information.
[0103] The second data information is a data set containing the hot / cold identification values of all virtual storage blocks. The second data information can be stored in the buffer of the memory controller and then backed up to the memory regularly. For example, the second data information can be a hot / cold identification table, which records the hot / cold identification values of all virtual storage blocks. Each entry in the hot / cold identification table is associated with a virtual storage block and records the hot / cold identification value of that virtual storage block. The hot / cold identification table is updated in real time, that is, every time data is written to a virtual storage block, the hot / cold identification value of the virtual storage block is incremented.
[0104] Exemplarily, referring to Figure 9 , in Figure 9 the second data information shown on the right, VBα represents the virtual storage block identifier, and HOT IDα represents the hot / cold identification value of the virtual storage block. That is, the hot / cold identification value of VB1 is HOT ID1, the hot / cold identification value of VB1 is HOT ID2, and so on. Therefore, by indexing with the identifier of the virtual storage block and traversing the second data information, the hot / cold identification value corresponding to the virtual storage block can be obtained.
[0105] The hot and cold identification values of the virtual storage blocks will be updated when data is written. In order to determine the hot and cold degree of the data written in the virtual storage blocks according to the hot and cold identification values, the latest hot and cold identification value, that is, the maximum hot and cold identification value, can also be combined for joint judgment.
[0106] In a feasible implementation manner, in Figure 9 the second data information shown, the maximum hot and cold identification value (max hot id) is also stored, and the maximum hot and cold identification value is the maximum value among all hot and cold identification values.
[0107] In a feasible implementation manner, the maximum hot and cold identification value may not be stored in the second data information either. By traversing the second data information, the largest one among all hot and cold identification values is determined as the maximum hot and cold identification value.
[0108] Referring to Figure 10 , in a possible implementation manner, when determining the first virtual storage block from which data is to be moved out and the second virtual storage block into which data is to be moved in, S20 may include the following methods.
[0109] S201: Determine the virtual storage block whose erasure count value is less than the first threshold and the difference between the hot and cold identification value and the maximum hot and cold identification value is greater than the second threshold as the first virtual storage block.
[0110] When selecting the first virtual storage block, all virtual storage blocks belonging to the data block pool can be screened, and the screening conditions include the erasure count value and the hot and cold identification value. Then, according to the screening conditions, the virtual storage blocks in the data block pool that meet the screening conditions are screened out.
[0111] Exemplarily, referring to Figure 11 and Figure 12 , in the first stage, that is, before data transfer, since the virtual storage blocks VB1, VB2, VB3, and VB4 store data, they all belong to the data block pool (Pool A). Then, according to the size relationship between the erasure count value of the virtual data block and the first threshold, and the size relationship between the difference between the hot and cold identification value of the virtual data block and the maximum hot and cold identification value and the second threshold, the virtual storage blocks VB1, VB2, VB3, and VB4 in the data block pool are screened. The first threshold is the difference between the erasure count value of the data block with the largest erasure count value in the free pool (Pool B) and the preset threshold value.
[0112] For example, the erasure count value (EC max free VB ) of the data block with the largest erasure count value in the free pool (Pool B) can be 140, and the preset threshold value (EC gap TH) It can be 40. Then the first threshold can be 100, the second threshold can be 2,600. The erasure count value of virtual storage block VB1 is 40, the difference between the hot-cold identification value and the maximum hot-cold identification value is 3,800. The erasure count value of virtual storage block VB2 is 150, the difference between the hot-cold identification value and the maximum hot-cold identification value is 4,500. The erasure count value of virtual storage block VB3 is 60, the difference between the hot-cold identification value and the maximum hot-cold identification value is 1,500. The erasure count value of virtual storage block VB4 is 100, the difference between the hot-cold identification value and the maximum hot-cold identification value is 3,500. The erasure count value of virtual storage block VB2 is greater than the first threshold, and the difference between the hot-cold identification value and the maximum hot-cold identification value of virtual storage block VB3 is less than the second threshold. Therefore, neither of them meets the screening conditions. While the erasure count values of virtual storage block VB1 and virtual storage block VB4 are less than the first threshold, and the difference between the hot-cold identification value and the maximum hot-cold identification value is greater than the second threshold. Therefore, they meet the screening conditions. Thus, virtual storage block VB1 and virtual storage block VB4 are determined as the first virtual storage blocks, and virtual storage block VB1 and virtual storage block VB4 are divided into the source virtual storage block pool (Pool C) composed of all the first virtual storage blocks. The virtual storage blocks in the source virtual storage block pool (Pool C) meet the screening conditions of both (Pool C) and (Pool A). Therefore, they belong to the source virtual storage block pool (Pool C) and the data block pool (Pool A), and the virtual storage blocks in the source virtual storage block pool (Pool C) all have the characteristics of few erasure times and the stored data being cold data.
[0113] S202: Determine the second virtual storage blocks as the virtual storage blocks whose erasure count values are greater than the third threshold.
[0114] When selecting the second virtual storage blocks, all the virtual storage blocks in the free pool can be screened. The screening condition is that the erasure count value is greater than the third threshold, and the third threshold is the sum of the erasure count value of the data block with the smallest erasure count value in the data pool (Pool A) and the preset threshold value. Then, according to the screening condition, the virtual storage blocks in the free pool that meet the screening condition are screened out.
[0115] Exemplarily, refer to Figure 11 and Figure 12 , in the first stage, that is, before data transfer, since virtual storage blocks VB5, VB6, and VB7 do not store data, they are all in the free pool (Pool B). Then, the virtual storage blocks VB5, VB6, and VB7 in the free pool are screened according to the size relationship between the erasure count value and the third threshold.
[0116] For example, the erasure count value (EC min usd VB ) of the data block with the smallest erasure count value in the data pool (Pool A) can be 60, and the preset threshold value (EC gapTH ) It can be 40, then the third threshold can be 100. The erasure count value of the virtual storage block VB5 is 180, the erasure count value of the virtual storage block VB6 is 90, and the erasure count value of the virtual storage block VB7 is 170. Therefore, the erasure count value of the virtual storage block VB6 is less than the third threshold, so it does not meet the screening conditions. While the erasure count values of the virtual storage block VB5 and the virtual storage block VB7 are greater than the third threshold, so they meet the screening conditions. Therefore, the virtual storage block VB5 and the virtual storage block VB7 are determined as the second virtual storage blocks, and the virtual storage block VB5 and the virtual storage block VB7 are divided into the target virtual storage block pool (Pool D) composed of all the second virtual storage blocks. The virtual storage blocks in the target virtual storage block pool (Pool D) meet the screening conditions of both (Pool D) and (Pool B), so they belong to the target virtual storage block pool (Pool D) and the free pool (Pool B), and the virtual storage blocks in the target virtual storage block pool (Pool D) all have the characteristics of a high erasure count and no data stored.
[0117] After the screening of the first virtual storage block and the second virtual storage block is completed, the data stored in the first virtual storage block can be moved to the second virtual storage block, so that the first virtual storage block is changed from the used state to the free state. The first virtual storage block in the free state can be used to store newly written data.
[0118] Exemplarily, refer to Figure 11 and Figure 12 , in the second stage, after triggering the data migration operation, data migration can be performed. Arbitrarily select a first virtual storage block from the source virtual storage block pool (Pool C). For example, select the virtual storage block VB1 as the source virtual storage block, and then arbitrarily select a second virtual storage block from the target virtual storage block pool (Pool D). For example, select the virtual storage block VB5 as the target virtual storage block. Then move the data stored in the virtual storage block VB1 to the virtual storage block VB5, and perform an erasure operation on the virtual storage block VB1. And divide the virtual storage block VB1 from the data block pool (Pool A) into the free pool (Pool B), and divide the virtual storage block VB5 from the free pool (Pool B) into the data block pool (Pool A). Changing the first virtual storage block from the used state to the free state, and the first virtual storage block in the free state can be used to store newly written data, which can increase the probability of using virtual storage blocks with a small erasure count, shorten the gap between the erasure count values of the virtual storage blocks, and achieve the effect of balanced wear.
[0119] The above embodiments illustrate the data migration process of the virtual storage block. When new data is written into the virtual storage block, the cold-hot identification value of the virtual storage block can be updated. Refer to Figure 13, in a possible implementation, before obtaining the erasure count value and the cold / hot identification value of each virtual storage block, the method further includes:
[0120] S301: In response to a data write instruction, write the data into the third virtual storage block and update the maximum cold / hot identification value.
[0121] When the memory controller receives a data write instruction and performs a write operation, a new virtual storage block will be used. The third virtual storage block selected to store the newly written data is a virtual storage block in the free pool. If the third virtual storage block has never been written with user data, the current cold / hot identification value of the third virtual storage block is 0. If the third virtual storage block has ever stored user data, the current cold / hot identification value of the third virtual storage block is the cold / hot identification value assigned during the last storage task performed on the third virtual storage block. When writing the data into the third virtual storage block, the maximum cold / hot identification value can be updated according to the amount of data written and the data storage mode of the third virtual storage block.
[0122] S302: Assign the cold / hot identification value of the third virtual storage block as the maximum cold / hot identification value.
[0123] After completing the update of the maximum cold / hot identification value, assign the updated maximum cold / hot identification value to the third virtual storage block to update the cold / hot identification value of the third virtual storage block, so that the third virtual storage block has the maximum cold / hot identification value, which also indicates that the data written into the third virtual storage block at this time is the hottest data.
[0124] Exemplarily, refer to Figure 14 , when the host detects a data write request, randomly select a third virtual storage block from pool B. For example, select virtual storage block VB6 to store the newly written data. After completing the data write, update the cold / hot identification value of virtual storage block VB6 from x to the current maximum cold / hot identification value y, and move virtual storage block VB6 from pool B to pool A.
[0125] The third virtual storage block is a virtual storage block located in the free pool. The specific process of screening out the third virtual storage block from the free pool includes: determining the virtual storage block with the smallest erasure count value and in the idle state as the third virtual storage block.
[0126] Exemplarily, since the virtual storage blocks VB5, VB6, and VB7 do not store data, they are all located in the free pool (Pool B). The erase count values of the virtual storage blocks VB5, VB6, and VB7 are 40, 20, and 30 respectively. It can be seen that the erase count value of the virtual storage block VB6 is the smallest. Therefore, the virtual storage block VB6 is used as the third virtual storage block to store the newly written data, while the virtual storage blocks VB5 and VB7 cannot be used as the third virtual storage block to store the newly written data.
[0127] When updating the maximum value of the cold-hot flag, the increase amount of the maximum value of the cold-hot flag can be determined first, and then based on the maximum value of the cold-hot flag before the update and the increase amount, the maximum value of the cold-hot flag after the update can be determined. For example, the maximum value of the cold-hot flag before the update can be added to the increase amount to determine the sum value as the maximum value of the cold-hot flag after the update.
[0128] Among them, the increase amount of the maximum value of the cold-hot flag is related to the amount of data written. In a feasible implementation manner, when writing data into the third virtual storage block and updating the maximum value of the cold-hot flag: when the amount of data written is the same, the increase amount of the maximum value of the cold-hot flag is the same.
[0129] The increase amount of the maximum value of the cold-hot flag depends on the amount of data written, that is, the size of the increase amount is determined based on the size of the amount of data written. Therefore, even if different data writing modes are adopted, but if the amount of data written is the same, then the increase amount of the maximum value of the cold-hot flag is the same.
[0130] Exemplarily, when the size of the amount of data written is 100MB, if the first mode is used to write data, the number of virtual storage blocks required is a, and the increase value of the maximum value of the cold-hot flag is A. If the second mode is used to write, the number of virtual storage blocks required is b, but the increase value of the maximum value of the cold-hot flag is also A.
[0131] In a possible implementation manner of the present disclosure, the specific relationship between the increment of the maximum value of the cold-hot flag and the data writing mode can be: when the data writing mode is the first mode, the maximum value of the cold-hot flag is increased by the first value, and when the data writing mode is the second mode, the maximum value of the cold-hot flag is increased by the second value.
[0132] For any virtual storage block, when different data writing modes are adopted, since the data storage amounts of different modes are different, the change values of the maximum value of the cold-hot flag are different. Exemplarily, the storage bit number of the second mode is m times that of the first mode, and the second value is m + 1 times that of the first value.
[0133] For example, when writing data in the triple level cell (TLC) mode (the second mode), every time a new virtual storage block is opened, the maximum value of the hot-cold flag increases by 4. When writing data in the single level cell (SLC) mode (the first mode), every time a new virtual storage block is opened, the maximum value of the hot-cold flag increases by 1.
[0134] Exemplarily, continue to illustrate with the first mode being the SLC mode and the second mode being the TLC mode. When the size of the written data is 100 MB, when writing data in the TLC mode, perhaps only one virtual storage block is needed to complete the data writing. Therefore, the maximum value of the hot-cold flag increases by 4. When writing data in the SLC mode, perhaps three virtual storage blocks are needed to complete the data writing. Therefore, the maximum value of the hot-cold flag increases by 3. When storing data, the data in the three virtual storage blocks written in the SLC mode can be moved to one virtual storage block. During this process, a new data garbage collection (data GC) virtual storage block is also opened. Therefore, the maximum value of the hot-cold flag increases by 1 again, that is, the maximum value of the hot-cold flag increases by 4 in total. Therefore, even when using different data writing modes, when the amount of written data is the same, the increase amount of the maximum value of the hot-cold flag is the same.
[0135] In the above examples, the second mode is exemplified as the TLC mode. In other embodiments of the present disclosure, the second mode may include any one of the multi level cell (MLC) mode, TLC mode, quad level cell (QLC) mode, or penta level cell (PLC) mode. The second mode may include any one of the MLC mode, QLC mode, or PLC mode. However, the storage bit number of the second mode is an integer multiple of the storage bit number of the first mode.
[0136] It can be understood that regardless of which storage mode the storage device adopts or how many storage modes it supports, the increment of the corresponding maximum value of the hot-cold flag can be set according to the integer multiple relationship between its storage bit number and the storage bit number of the SLC mode.
[0137] The operating method of the storage system provided by the present disclosure uses both the erase count value and the hot and cold identification value as screening conditions to implement the screening of virtual storage blocks. When screening the first virtual storage block, the screening can be performed based on the size relationship between the erase count value and the preset threshold value, and the size relationship between the difference between the hot and cold identification value and the maximum value of the hot and cold identification and the preset threshold value. When screening the second virtual storage block, the screening can be performed based on the size relationship between the erase count value and the preset threshold value. On the one hand, it avoids the situation where the virtual storage block storing hot data is screened out and the data stored in it is moved, thereby reducing the possibility of the occurrence of write amplification, thereby extending the service life of the solid-state hard disk. On the other hand, it can increase the probability of using virtual storage blocks with a small number of erase times, shorten the gap between the erase count values of the virtual storage blocks, achieve the effect of balanced wear, and thereby extend the service life of the solid-state hard disk.
[0138] The embodiment of the present disclosure further provides a storage controller 111, which can be, for example, the aforementioned Figure 6 The storage controller 111 shown includes a processor 211, a host interface circuit 212, a data buffer circuit 213, an ECC module 214, a garbage collection module 215, a wear leveling module 216, and a memory interface circuit 217, and the storage controller 111 is coupled to the memory 112. Exemplarily, the processor 211 is connected to the host 100 through the host interface circuit 212, and is connected to the memory 112 through the memory interface circuit 217, and the data buffer circuit (cache) 213 is configured to store first data information and second data information, wherein the first data information stores the identifier and the erase count value of the virtual storage block, and the second data information stores the identifier and the cold and hot identifier value of the virtual storage block. The processor 211 is configured to obtain an erase count value and a hot / cold identification value of each virtual storage block, wherein the hot / cold identification value represents the hot / cold degree of the data stored in the corresponding virtual storage block, and determine the first virtual storage block from which data is moved out and the second virtual storage block from which data is moved in based on the erase count value and the hot / cold identification value of each virtual storage block, and move the data stored in the first virtual storage block to the second virtual storage block.
[0139] In a possible implementation manner of the present disclosure, the processor 211 is specifically configured to obtain an erase count value of each virtual storage block from the first data information, and obtain a hot or cold identification value of each virtual storage block from the second data information.
[0140] In a possible implementation of the present disclosure, the second data information further includes a maximum hot-cold flag value, which is the maximum value among the hot-cold flag values. The processor 211 is specifically configured to determine a first virtual storage block for which the erasure count value is less than a first threshold and the difference between the hot-cold flag value and the maximum hot-cold flag value is greater than a second threshold, and determine a second virtual storage block for which the erasure count value is greater than a third threshold.
[0141] In a possible implementation of the present disclosure, the storage controller further includes a host interface circuit for connecting to a host. The processor 211 is further configured to, in response to a data write instruction received by the host interface circuit, write data into a third virtual storage block, update the maximum hot-cold flag value, and assign the hot-cold flag value of the third virtual storage block to the maximum hot-cold flag value.
[0142] In a possible implementation of the present disclosure, the processor 211 is further configured to determine a third virtual storage block that is in an idle state and has the minimum erasure count value.
[0143] In a possible implementation of the present disclosure, the processor 211 is further configured to, when the amount of written data is the same, increase the maximum hot-cold flag value by the same amount.
[0144] In a possible implementation of the present disclosure, the processor 211 is further configured to determine a data storage mode of the third virtual storage block. The data storage mode includes a first mode and a second mode. Among them, the storage bit number of the second mode is m times that of the first mode. When the data storage mode of the third virtual storage block is the first mode, increase the maximum value of the data hot-cold type flag by a first value. When the data storage mode of the third virtual storage block is the second mode, increase the maximum value of the data hot-cold type flag by a second value, where the second value is m + 1 times the first value.
[0145] An embodiment of the present disclosure further provides a storage system, including: a memory 112 and a storage controller 111. The storage controller 111 is coupled to the memory 112 through a memory interface circuit 217. The storage controller 111 is configured to obtain the erasure count value and the hot-cold flag value of each virtual storage block. Among them, the hot-cold flag value represents the hot-cold degree of the data stored in the corresponding virtual storage block. According to the erasure count value and the hot-cold flag value of each virtual storage block, determine a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in, and move the data stored in the first virtual storage block to the second virtual storage block.
[0146] In a possible implementation of the present disclosure, the storage controller 111 stores first data information and second data information, where the first data information includes the identifier of the virtual storage block and the erasure count value, and the second data information includes the identifier of the virtual storage block and the cold-hot identification value. The storage controller 111 is specifically configured to obtain the erasure count value of each virtual storage block from the first data information through the flash interface circuit, and obtain the cold-hot identification value of each virtual storage block from the second data information through the flash interface circuit.
[0147] In a possible implementation of the present disclosure, the second data information further includes the maximum cold-hot identification value, which is the maximum value among the cold-hot identification values. The storage controller 111 is specifically configured to determine the first virtual storage block for the virtual storage block whose erasure count value is less than the first threshold and the difference between the cold-hot identification value and the maximum cold-hot identification value is greater than the second threshold, and determine the second virtual storage block for the virtual storage block whose erasure count value is greater than the third threshold.
[0148] In a possible implementation of the present disclosure, the storage controller 111 further includes a host interface circuit for connecting to the host. The storage controller 111 is further configured to respond to a data write instruction received by the host interface circuit, write the data into the third virtual storage block, update the maximum cold-hot identification value, and assign the cold-hot identification value of the third virtual storage block to the maximum cold-hot identification value.
[0149] In a possible implementation of the present disclosure, the storage controller 111 is further configured to determine the third virtual storage block as the virtual storage block that is in the idle state and has the minimum erasure count value.
[0150] In a possible implementation of the present disclosure, the storage controller 111 is further configured that when the amount of written data is the same, the increase amount of the maximum cold-hot identification value is the same.
[0151] In a possible implementation of the present disclosure, the storage controller 111 is further configured to determine the data storage mode of the third virtual storage block. The data storage mode includes a first mode and a second mode. Among them, the storage bit number of the second mode is m times that of the first mode. When the data storage mode of the third virtual storage block is the first mode, increase the maximum value of the data cold-hot type identification by a first value. When the data storage mode of the third virtual storage block is the second mode, increase the maximum value of the data cold-hot type identification by a second value, where the second value is m + 1 times the first value.
[0152] The storage controller provided by the embodiments of the present disclosure may include a cache and one or more processors. Computer-executable instructions are stored in the cache, and the one or more processors execute the computer-executable instructions to be able to implement the operation method of the storage system of the present disclosure.
[0153] An embodiment of the present disclosure further provides an electronic device, which includes a host and the aforementioned storage system. The host is connected to the storage system and is used to store data in the storage system or read data read from the storage system. Exemplarily, the electronic device may be the electronic device shown in the aforementioned examples Figure 1 of the electronic device.
[0154] This embodiment provides a computer-readable storage medium, on which a computer program is stored. The computer program is used to implement the operation method of the storage system as disclosed in the present disclosure.
[0155] Those skilled in the art can clearly understand that for the convenience and brevity of description, in the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the corresponding procedures in the foregoing method embodiments, which will not be elaborated herein.
[0156] In several embodiments provided by the present disclosure, it should be understood that the provided programming method and memory can be implemented in other ways. For example, the division of a certain module is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0157] Those of ordinary skill in the art can realize that the modules and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present disclosure.
[0158] The above is only the specific implementation manner of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present disclosure should be covered by the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims
1. A method for operating a storage system, characterized in that, the method includes: Obtaining the erasure count value and the cold / hot identification value of each virtual storage block, wherein the cold / hot identification value characterizes the cold / hot degree of the data stored in the corresponding virtual storage block; Determining a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in according to the erasure count value and the cold / hot identification value of each virtual storage block; Moving the data stored in the first virtual storage block to the second virtual storage block.
2. The method according to claim 1, characterized in that, the obtaining the erasure count value and the cold / hot identification value of each virtual storage block includes: Obtaining the erasure count value of each virtual storage block from first data information, wherein the first data information includes the identification of the virtual storage block and the erasure count value; Obtaining the cold / hot identification value of each virtual storage block from second data information, wherein the second data information includes the identification of the virtual storage block and the cold / hot identification value.
3. The method according to claim 2, characterized in that, the second data information further includes a maximum cold / hot identification value, which is the maximum value among the cold / hot identification values, and the determining a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in according to the erasure count value and the cold / hot identification value of each virtual storage block includes: Determining a virtual storage block whose erasure count value is less than a first threshold and the difference between whose cold / hot identification value and the maximum cold / hot identification value is greater than a second threshold as the first virtual storage block; Determining a virtual storage block whose erasure count value is greater than a third threshold as the second virtual storage block.
4. The method according to claim 1, characterized in that, it further includes: In response to a data write instruction, writing data into a third virtual storage block and updating the maximum cold / hot identification value; Assigning the cold / hot identification value of the third virtual storage block to the maximum cold / hot identification value.
5. The method according to claim 4, characterized in that, before writing data into the third virtual storage block and updating the maximum cold / hot identification value in response to a data write instruction, the method further includes: Determining the virtual storage block in an idle state and having the smallest erasure count value as the third virtual storage block.
6. The method according to claim 4, characterized in that, when the amount of written data is the same, the increase amount of the maximum cold / hot identification value is the same.
7. The method according to claim 6, characterized in that, writing data into the third virtual storage block and updating the maximum cold / hot identification value includes: Determining the data storage mode of the third virtual storage block, the data storage mode including a first mode and a second mode, wherein the storage bit number of the second mode is m times that of the first mode; When the data storage mode of the third virtual storage block is the first mode, increasing the maximum value of the data cold / hot type identification by a first value; When the data storage mode of the third virtual storage block is the second mode, increase the maximum value of the data cold-hot type identifier by a second value, where the second value is m + 1 times the first value.
8. The method according to claim 1, wherein, before determining the first virtual storage block from which data is to be moved out and the second virtual storage block into which data is to be moved in, the method further includes: determining the magnitude relationship between the difference between the maximum and minimum erasure count values of the virtual storage block and a fourth threshold; in response to the difference between the maximum and minimum erasure count values of the virtual storage block being greater than the fourth threshold, determining the first virtual storage block from which data is to be moved out and the second virtual storage block into which data is to be moved in.
9. A storage controller, wherein, comprising a buffer configured to: store first data information and second data information, wherein the first data information stores the identifier and erasure count value of a virtual storage block, and the second data information stores the identifier and cold-hot identifier value of a virtual storage block, and the cold-hot identifier value characterizes the cold-hot degree of the data stored in the corresponding virtual storage block; and a processor coupled to the buffer and configured to: obtain the erasure count value and cold-hot identifier value of each virtual storage block; determine the first virtual storage block from which data is to be moved out and the second virtual storage block into which data is to be moved in according to the erasure count value and cold-hot identifier value of each virtual storage block; move the data stored in the first virtual storage block to the second virtual storage block.
10. The storage controller according to claim 9, wherein, the processor is specifically configured to: obtain the erasure count value of each virtual storage block from the first data information; obtain the cold-hot identifier value of each virtual storage block from the second data information.
11. The storage controller according to claim 10, wherein, the second data information further includes a maximum cold-hot identifier value, which is the maximum value among the cold-hot identifier values, and the processor is specifically configured to: determine the virtual storage block with an erasure count value less than a first threshold and a difference between the cold-hot identifier value and the maximum cold-hot identifier value greater than a second threshold as the first virtual storage block; determine the virtual storage block with an erasure count value greater than a third threshold as the second virtual storage block.
12. The storage controller according to claim 9, wherein, the storage controller further includes a host interface circuit configured to receive a data write instruction; the processor is further configured to: in response to the data write instruction received by the host interface circuit, write data to a third virtual storage block and update the maximum cold-hot identifier value; assign the cold-hot identifier value of the third virtual storage block as the maximum cold-hot identifier value.
13. The storage controller according to claim 12, wherein, the processor is further configured to: determine the virtual storage block in an idle state and having the minimum erasure count value as the third virtual storage block.
14. The storage controller according to claim 12, wherein, When the amount of written data is the same, the increase in the maximum value of the cold-hot identifier is the same.
15. The storage controller according to claim 14, wherein, the processor is further configured to: determine the data storage mode of the third virtual storage block, the data storage mode including a first mode and a second mode, wherein the number of storage bits in the second mode is m times the number of storage bits in the first mode; when the data storage mode of the third virtual storage block is the first mode, increase the maximum value of the data cold-hot type identifier by a first value; when the data storage mode of the third virtual storage block is the second mode, increase the maximum value of the data cold-hot type identifier by a second value, wherein the second value is m + 1 times the first value.
16. The storage controller according to claim 9, wherein, the processor is further configured to: determine the magnitude relationship between the difference between the maximum erasure count value and the minimum erasure count value of the virtual storage block and a fourth threshold; in response to the difference between the maximum erasure count value and the minimum erasure count value of the virtual storage block being greater than the fourth threshold, determine a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in.
17. A storage system, wherein, comprising: a memory including a plurality of storage blocks, and a storage controller, the storage controller being coupled to the memory through a flash interface circuit and being configured to: acquire the erasure count value and the cold-hot identifier value of each virtual storage block, wherein each virtual storage block includes at least one of the storage blocks, and the cold-hot identifier value characterizes the cold-hot degree of the data stored in the corresponding virtual storage block; determine a first virtual storage block from which data is to be moved out and a second virtual storage block into which data is to be moved in according to the erasure count value and the cold-hot identifier value of each virtual storage block; move the data stored in the first virtual storage block to the second virtual storage block.
18. The storage system according to claim 17, wherein, the first data information and the second data information are stored in the storage controller, wherein the first data information includes the identifier and the erasure count value of the virtual storage block, and the second data information includes the identifier and the cold-hot identifier value of the virtual storage block, and the storage controller is specifically configured to: acquire the erasure count value of each virtual storage block from the first data information; acquire the cold-hot identifier value of each virtual storage block from the second data information.
19. The storage system according to claim 18, wherein, the second data information further includes a maximum cold-hot identifier value, the maximum cold-hot identifier value being the maximum value among the cold-hot identifier values, and the storage controller is specifically configured to: determine a virtual storage block with an erasure count value less than a first threshold and a difference between the cold-hot identifier value and the maximum cold-hot identifier value greater than a second threshold as the first virtual storage block; determine a virtual storage block with an erasure count value greater than a third threshold as the second virtual storage block.
20. The storage system according to claim 17, wherein, The storage controller further includes a host interface circuit for connecting to a host, and the storage controller is further configured to: In response to a data write instruction received by the host interface circuit, write the data into a third virtual storage block and update the maximum cold / hot identification value; Assign the cold / hot identification value of the third virtual storage block to the maximum cold / hot identification value.
21. The storage system according to claim 20, wherein, the storage controller is further configured to: Determine the virtual storage block in an idle state and having the smallest erasure count value as the third virtual storage block.
22. The storage system according to claim 20, wherein, the storage controller is further configured to: when the amount of written data is the same, the increase amount of the maximum cold / hot identification value is the same.
23. The storage system according to claim 22, wherein, the storage controller is further configured to: Determine the data storage mode of the third virtual storage block, where the data storage mode includes a first mode and a second mode, and wherein the storage bit number of the second mode is m times that of the first mode; When the data storage mode of the third virtual storage block is the first mode, increase the maximum value of the data cold / hot type identification by a first value; When the data storage mode of the third virtual storage block is the second mode, increase the maximum value of the data cold / hot type identification by a second value, where the second value is m + 1 times the first value.
24. The storage system according to claim 17, wherein, the storage controller is further configured to: Determine the magnitude relationship between the difference between the maximum erasure count value and the minimum erasure count value of the virtual storage block and a fourth threshold; In response to the difference between the maximum erasure count value and the minimum erasure count value of the virtual storage block being greater than the fourth threshold, determine a first virtual storage block for data evacuation and a second virtual storage block for data relocation.
25. A readable storage medium, wherein, the readable storage medium includes a stored program, and wherein when the program runs, it controls the device where the readable storage medium is located to execute the method according to any one of claims 1 - 8.