Memory controller and data storage system

By introducing multiple data integration modes into the memory controller, and determining whether to execute the data integration program based on the status information and threshold of the entity unit, the read and write efficiency problem caused by invalid data occupying space in the non-volatile memory module is solved. Improves memory performance and service quality.

CN119065600AActive Publication Date: 2024-12-03HEFEI KAIMENG TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410992024.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-12-03
Estimated Expiration
2044-07-23

AI Technical Summary

Technical Problem

During the data writing process, existing non-volatile memory modules occupy the storage space, resulting in garbage collection affecting the read and write efficiency of the memory. How to ensure the quality of the memory service is a technical challenge.

Method used

By introducing multiple data integration modes into the memory controller, the host system or user allows the host system or user to select appropriate modes according to needs, obtain status information of memory entity units, and decide whether to execute data integration programs based on specified thresholds to optimize storage space Use of

Benefits of technology

It improves the memory write speed and read and write efficiency, avoids performance reduction due to garbage collection, meets the storage needs in different scenarios, and balances the device life and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065600A_ABST
    Figure CN119065600A_ABST
Patent Text Reader

Abstract

The invention provides a memory controller and a data storage system. The memory controller is configured to perform a plurality of steps of: switching a default mode to a specified mode in response to a first parameter of the register being updated; reading a second parameter of the register to determine a specified threshold; acquiring state information of the entity unit according to a specified mode; and if the state information of the entity unit meets the specified threshold value, executing a data consolidation program on the memory according to a specified mode. In this way, the memory controller operates in different modes in different scenarios to execute a data consolidation program.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a memory management technology, and in particular to a memory controller and a data storage system in which a data consolidation mode is determined by a host system. Background Art

[0002] Non-volatile memory modules (such as flash memory modules) have the advantages of non-volatile data storage, low power consumption, and fast data access. Generally speaking, some idle physical units are configured by default in the non-volatile memory module to receive and store data from the host system. However, in the process of writing data to the non-volatile memory module, a large amount of invalid data in the used physical units occupies the storage space. In order to avoid the storage space being exhausted, garbage collection is generally performed to release the storage space for subsequent use.

[0003] However, performing garbage collection will reduce the write speed of the host system. The existing garbage collection strategy will affect the read and write efficiency of the storage device. How to ensure the service quality of the storage device is an issue of concern to technicians in this field. Summary of the invention

[0004] The present invention provides a memory controller and a data storage system, wherein a host system can select a data consolidation mode, and different data consolidation strategies can be selected in different scenarios to meet user needs.

[0005] An embodiment of the present invention provides a memory controller electrically connected to a memory and a register, wherein the memory includes a plurality of physical units. The memory controller is used to perform a plurality of steps: in response to a first parameter of the register being updated, switching a default mode to a specified mode; reading a second parameter of the register to determine a specified threshold; acquiring state information of the physical unit according to the specified mode; and if the state information of the physical unit meets the specified threshold, performing a data consolidation procedure on the memory according to the specified mode.

[0006] From another perspective, an embodiment of the present invention provides a data storage system, comprising: a memory, comprising a plurality of physical units; a register, comprising a first parameter and a second parameter; and a memory controller, connected to a host system, the register and the memory. The host system is used to perform a plurality of steps: obtaining status information of the physical units in the memory according to the data to be written; judging whether the memory meets the writing conditions of the data to be written according to the status information; and if the writing conditions are not met, sending a mode instruction to update the register to switch the default mode of the memory controller to a specified mode. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] Figure 1 is a schematic diagram of a storage device according to an embodiment;

[0008] Figure 2 is a schematic diagram of a management memory module according to an embodiment;

[0009] Figure 3 is a schematic diagram showing a data consolidation program mode determined by a user according to an embodiment;

[0010] Figure 4 is a schematic diagram showing each bit in a register according to an embodiment;

[0011] Figure 5 is a schematic diagram of a data consolidation procedure in the second mode according to an embodiment;

[0012] Figure 6 is a flow chart of a method for selecting a mode for data consolidation according to an embodiment;

[0013] Figure 7 is a flow chart of a method for selecting a mode for data consolidation according to another embodiment. DETAILED DESCRIPTION

[0014] Reference will now be made in detail to exemplary embodiments of the present invention, examples of which are illustrated in the accompanying drawings. Whenever possible, the same reference numerals are used in the drawings and the description to refer to the same or like parts.

[0015] Figure 1 is a schematic diagram of a data storage system according to an embodiment. Figure 1 The data storage system 100 includes a storage device 10 and a host system 11. The host system 11 can be any type of computer system, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, an industrial computer, a game console, a server or a vehicle-mounted computer, etc., and the type of the host system 11 is not limited thereto.

[0016] The storage device 10 is connected to the host system 11 and is used to store data from the host system 11. For example, the storage device 10 may include a solid state drive, a USB flash drive, a memory card, or other types of non-volatile storage devices. The host system 11 can communicate with the storage device 10 through an embedded Multi-Media Card (eMMC), a Universal Flash Storage (UFS), a Peripheral Component Interconnect Express (PCI Express), a fast non-volatile memory (Non-Volatile Memory Express, NVM express), a Serial Advanced Technology Attachment (SATA), a Universal Serial Bus (USB), or other types of connection interface standards. Therefore, the host system 11 can store data to the storage device 10 and / or read data from the storage device 10.

[0017] The storage device 10 includes a connection interface unit 101, a memory 102, a memory controller 103, and a register 104. The connection interface unit 101 is used to connect the storage device 10 to the host system 11. For example, the connection interface unit 101 can support connection interface standards such as eMMC, UFS, PCI Express, NVM express, SATA, PCI Express, or USB. The storage device 10 can communicate with the host system 11 (e.g., exchange signals and / or data) via the connection interface unit 101.

[0018] The memory 102 is used to store data. The memory 102 may include one or more rewritable non-volatile memory modules. Each rewritable non-volatile memory module may include one or more memory cell arrays. The memory cells in the memory cell array store data in the form of voltage. For example, the memory 102 may include a single-level cell (SLC) NAND flash memory module, a multi-level cell (MLC) NAND flash memory module, a triple-level cell (TLC) NAND flash memory module, a quad-level cell (QLC) NAND flash memory module and / or other memory modules having the same or similar characteristics.

[0019] The memory controller 103 is connected to the connection interface unit 101, the register 104 and the memory 102. The memory controller 103 can be regarded as the control core of the memory device 10 and is used to control the memory device 10. For example, the memory controller 103 can be responsible for controlling and / or managing the entire or partial operation of the memory device 10. For example, the memory controller 103 may include a central processing unit (CPU), or other programmable general-purpose or special-purpose microprocessors, digital signal processors (DSP), programmable controllers, application specific integrated circuits (ASIC), programmable logic devices (PLD) or other similar devices or combinations of these devices. In one embodiment, the memory controller 103 includes a flash memory controller.

[0020] The register 104 is used to implement specific functions and is a small storage area for temporarily storing codes and instructions inside the storage device 10. For example, the register 104 may include a card identification register (CID), a card specific data register (CSD), a configuration register (SCR), and an operating condition register (OCR). In one embodiment, the register 104 includes a CSD register. In one embodiment, the memory controller 103 may also include a buffer memory, a power management circuit, an encoding circuit, a decoding circuit, and / or other types of various circuit modules, which are not limited by the present invention. The buffer memory is used to cache data. The power management circuit is used to manage the power supply of the storage device 10. The encoding circuit is used to encode the data to be stored in the memory 102 to generate an error correction code (and / or an error checking code). The decoding circuit is used to decode the data read from the memory 102 to correct possible errors in the read data. For example, the encoding circuit and / or decoding circuit may use various encoding / decoding algorithms such as Low Density Parity Check code (LDPC code), BCH code, Reed-Solomon code (RS code), Exclusive OR (XOR) code, etc. to encode and decode data.

[0021] The memory 102 may receive a command sequence from the memory controller 103 and access the storage unit according to the command sequence. For example, when data is to be stored, the memory controller 103 may send a write command sequence to the memory 102 to instruct the memory 102 to store the data in a specific storage unit. When data is to be read, the memory controller 103 may send a read command sequence to the memory 102 to instruct the memory 102 to read data from a specific storage unit. When data is to be deleted, the memory controller 103 may send an erase command sequence to the memory 102 to instruct the memory 102 to erase the data stored in the specific storage unit. In addition, the memory controller 103 may also send other types of command sequences to the memory 102 to instruct the memory 102 to perform corresponding operations, which is not limited by the present invention.

[0022] Figure 2 FIG. 1 is a schematic diagram of a management memory module according to an embodiment. Figure 1 and Figure 2 The memory 102 includes a plurality of physical units 201 ( 1 ) to 201 (B). Each physical unit includes a plurality of storage cells and is used for non-volatile storage of data.

[0023] In one embodiment, a physical unit may include multiple physical sectors. For example, the data capacity of a physical sector may be 512 bytes (Bytes, B), and a physical unit may include 8 physical sectors. However, the data capacity of a physical sector and / or the total number of physical sectors included in a physical unit may be adjusted according to practical needs, and the present invention is not limited thereto. In one embodiment, a physical unit may be regarded as a physical page. For example, the data capacity of a physical page may be 4 kilobytes (4KB), and the present invention is not limited thereto.

[0024] In one embodiment, a physical page is the minimum unit for synchronously writing data in the memory 102. For example, when a programming operation is performed on a physical page to write data to the physical page, multiple memory cells in the physical page can be synchronously programmed to store corresponding data. For example, when programming a physical page, a write voltage can be applied to the physical page to change the threshold voltage of at least some of the memory cells in the physical page. The threshold voltage of each memory cell can reflect the bit data stored in the memory cell.

[0025] In one embodiment, the memory 102 may include a plurality of physical blocks. Each physical block may include a plurality of physical cells. In particular, a plurality of physical cells (e.g., physical pages) in the same physical block may be erased synchronously. For example, when erasing a physical block, an erase voltage may be applied to a plurality of physical pages in the physical block to change the threshold voltage of at least a portion of the memory cells in these physical pages and clear the bit data stored in each memory cell in these physical pages.

[0026] In one embodiment, the memory controller 103 may logically associate the physical units 201(1)-201(A) with the data area 21 and associate the physical units 201(A+1)-201(B) with the spare area 22. The physical units 201(1)-201(A) in the data area 21 are used to store data (also referred to as user data) from the host system 11. For example, each physical unit in the data area 21 may store valid data and / or invalid data. In addition, the physical units 201(A+1)-201(B) in the spare area 22 do not store data.

[0027] In one embodiment, if a physical unit does not store valid data, the physical unit may be associated with the idle area 22. In one embodiment, the idle area 22 is also called an idle pool, and the physical units in the idle area 22 are also called idle physical units. In addition, the physical unit associated with the idle area 22 may be erased to clear the data in the physical unit.

[0028] In one embodiment, when data (i.e., user data) from the host system 11 needs to be stored, the memory controller 103 may select one or more physical units from the idle area 22 and instruct the memory 102 to store the data from the host system 11 into the selected physical units. At the same time, the selected physical units may be associated with the data area 21.

[0029] In one embodiment, the memory controller 103 may configure a plurality of logical units 230(1)-230(C) to map the physical units 201(1)-201(A) in the data area 21. For example, one logical unit may correspond to a logical block address (LBA) or other logical management unit (e.g., a logical page). One logical unit may be mapped to one or more physical units in the data area 21.

[0030] In one embodiment, if a physical unit is currently mapped by any logical unit, the memory controller 103 may determine that the data currently stored in the physical unit includes valid data. Conversely, if a physical unit is not currently mapped by any logical unit, the memory controller 103 may determine that the physical unit does not currently store any valid data (and / or the data in the physical unit are all invalid data).

[0031] In one embodiment, the memory controller 103 may record the mapping relationship between the logical unit and the physical unit in a logical-to-physical mapping table. When receiving an access instruction (such as a read instruction, a write instruction, a delete instruction, or other types of instructions) from the host system 11, the memory controller 103 may instruct the memory 102 to perform a corresponding operation behavior according to the information in the logical-to-physical mapping table.

[0032] The memory controller 103 may perform a data consolidation procedure as required, which is also called a garbage collection procedure. When performing the data consolidation procedure, the memory controller 103 may select at least one physical unit from the data area 21 as a source physical unit and select at least one physical unit from the idle area 22 as a target physical unit. The memory controller 103 may copy the valid data stored in the source physical unit to the target physical unit. After the valid data stored in the source physical unit is copied to the target physical unit, all data in the source physical unit will be marked as invalid and the source physical unit may be divided into the idle area 22. In addition, the physical unit divided into the idle area 22 may be erased to clear the data stored in the physical unit. In one embodiment, the operation of re-dividing a physical unit from the data area 21 to the idle area 22 is also called releasing a physical unit. That is, during the start of the data consolidation procedure, one or more physical units may be gradually released and the total number of physical units belonging to the idle area 22 may be gradually increased. In addition, the physical unit that does not store valid data is called an idle physical unit.

[0033] In particular, in this embodiment, there are multiple modes for executing the data consolidation process, and the host system 11 can specify which mode to use. Figure 3 is a schematic diagram showing a data consolidation program mode determined by a user according to an embodiment. Figure 3, the user 300 can operate the user window on the host system 11, and multiple options can be provided in the user window for the user 300 to choose from. For example, the host system 11 can directly display all selectable modes on the user window, or allow the user to input what operation he wants to perform at present (for example, he wants to write a large-capacity file), or allow the user to input whether he prefers performance or service life. Based on the user's input, the host system 11 will transmit the mode command to the storage device 10. Figure 3 In the embodiment of the present invention, there are four modes, namely, the first mode, the second mode, the default mode and the reserved mode, which are also called preset modes. In different preset modes, the storage device 10 will execute the data consolidation procedure with different strategies. The following will describe in detail the mode instructions and the operations of different preset modes.

[0034] Please refer to Figure 1 In one embodiment, the memory controller 103 is electrically connected to the register 104 and modifies the register 104 according to the mode instruction obtained from the connection interface unit 101. For example, when the connection interface unit 101 supports the eMMC standard, the register 104 may be an EXT-CSD register. The size of the EXT-CSD register is 512 bytes, of which 320 bytes are attribute segments, which define the function of the register and cannot be modified by the host system 11. The other 192 bytes are mode segments, which define the configuration of the register operation, some of which can be modified by the host system 11, for example, the host system 11 can modify the content in the EXT-CSD register through the SWITCH instruction. When the connection interface unit 101 supports other standards (such as UFS), the modifiable registers therein may also be used, and the name of the register used may not be EXT-CSD but may have other names, and the present invention does not limit which register to be used. In other embodiments, the host system 11 may also directly transmit the mode instruction to the memory controller 103, and the present invention is not limited thereto.

[0035] Figure 4 is a schematic diagram showing each bit in a register according to an embodiment. Figure 4 In this example, table 400 is used to present 8 bits in register 104, which indicate the mode state. Register 104 includes two parameters, namely, a first parameter and a second parameter. In this example, the lower two bits Bit[1:0] read from register 104 are used as the first parameter, and the first parameter is used to determine the specified mode; and the upper six bits Bit[7:2] are the second parameter, and the second parameter is used to determine the specified threshold.

[0036] In this embodiment, there are 4 preset modes. When the value represented by the bit Bit[1:0] is 1, it corresponds to the first mode. When the value represented by the bit Bit[1:0] is 2, it corresponds to the second mode. When the value represented by the bit Bit[1:0] is 0, it corresponds to the default mode. When the value represented by the bit Bit[1:0] is 3, it corresponds to the reserved mode. The memory controller 103 can read the bit Bit[1:0] from the register 104 to obtain the corresponding specified mode. In other embodiments, different first parameters may correspond to other preset modes. When the number of preset modes is greater, more bits may be used as the first parameter.

[0037] The second parameter is used to determine the specified threshold. Since only 6 bits Bit[7:2] can be used to determine the specified threshold, the values ​​represented by the 6 bits are in the range of 0 to 63. This covers a smaller range of values. If more bits are added, an additional byte is required. Therefore, in one embodiment, the values ​​represented by the multiple bits Bit[7:2] read from the register 104 can be multiplied by a ratio to serve as the specified threshold. The ratio is, for example, 2, but in other embodiments it can also be 3 or other values. For example, if the value represented by the bit Bit[7:2] is 20 and the ratio is 2, then the specified threshold is equal to 20*2=40. This approach can cover a wider range of values ​​while using less register space.

[0038] In one embodiment, more bits may be used as the second parameter, and the number of specified thresholds may be greater than one. For example, two specified thresholds are used to represent a range, and multiple bits in the register may be used to generate the lower limit of the range, and another multiple bits may be used to generate the upper limit of the range. The values ​​represented by these bits may also be multiplied by a ratio to obtain the corresponding lower limit or upper limit, and the ratios used for the lower limit and the upper limit may be different.

[0039] Generally, the memory controller 103 will operate in the default mode. After the host system 11 transmits the mode instruction to the storage device 10, the memory controller 103 will receive the mode instruction to modify the register 104, and update the first parameter and the second parameter in the register 104. When the first parameter is updated, it means that the host system 11 wants to switch the mode, so the memory controller 103 will switch the default mode to the specified mode. This specified mode is determined by the first parameter, and the bits in the first parameter are used to select one of the above-mentioned multiple preset modes as a specified mode, that is, the specified mode belongs to one of the multiple preset modes. In different specified modes, the memory controller 103 will obtain different status information about the physical unit. Such status information is, for example, the number (or percentage) of valid data in the physical unit, the capacity of all idle physical units, the number of times each physical unit is erased, the update frequency of valid data in the physical unit, the degree of dispersion of valid data in the physical unit, etc., but the present invention is not limited thereto.

[0040] The memory controller 103 may obtain first state information when the designated mode belongs to the first mode, obtain second state information when the designated mode belongs to the second mode, and obtain third state information when the designated mode belongs to the default mode, wherein the first state information, the second state information and the third state information are different from each other. Different state information reflects different data consolidation strategies, some strategies may be designed to quickly generate a small number of idle physical units, some strategies may be designed to generate a large number of idle physical units at a time, and some strategies may be designed to extend the service life of the storage device 10, etc. By obtaining different state information, the user's goals can be better met.

[0041] When the designated mode belongs to the default mode, the memory controller 103 obtains the third state information according to the default mode, and the third state information includes the remaining storage space of all physical units. The memory controller 103 determines whether the remaining storage space is less than the specified threshold value, and if so, executes the data consolidation procedure until the remaining storage space is not less than the specified threshold value. In some embodiments, the remaining storage space can be expressed as a percentage of all storage spaces. For example, if the storage capacity of all physical units is 100GB, if the remaining storage space is 3GB, it can be expressed as 3 / 100=3%.

[0042] In one embodiment, when the specified mode belongs to the first mode, the first state information obtained includes the proportion of valid data in each physical unit. In this mode, it is determined whether the proportion of valid data in each physical unit is less than the specified threshold. If so, the corresponding physical unit is marked. Next, the data consolidation program is preferentially executed on the marked physical units, that is, the marked physical units will be regarded as source physical units, and the valid data therein will be moved to the target physical units. The setting of the specified threshold will affect which physical units are marked. When the specified threshold is smaller (for example, between 10 and 30), it means that there are very few valid data in the marked physical units. Prioritizing the execution of the data consolidation program on these physical units can quickly release these physical units and generate idle physical units. After the marked physical units have completed the data consolidation program, other physical units can be selected according to the default logic to continue to execute the data consolidation program, or the data consolidation program can be interrupted. The present invention is not limited to this.

[0043] In one embodiment, when the specified mode belongs to the second mode, the second state information obtained includes the capacity of the idle entity unit, and this value can be expressed as a percentage. For example, if the capacity of the idle entity unit is 50GB, and the capacity that all entity units can store is 100GB, then 50 / 100=50% is used to represent the capacity of the idle entity unit. In another embodiment, the capacity of the idle entity unit can also be represented by the number of idle entity units. In this mode, it will be determined whether the capacity of the idle entity unit is less than the specified threshold. If so, the data consolidation program is executed until the capacity of the idle entity unit is not less than the specified threshold. This mode allows users to start the data consolidation program as needed to release more idle entity units. For example, when a large file data needs to be written, since the file data needs to be written sequentially, a large amount of continuous storage space is required. When there is a large amount of fragmented storage space in the memory, garbage collection in the default mode will not be triggered at present, but there is not enough continuous storage space to perform continuous writing of large files. Therefore, before writing a large file, the designated mode is first set to the second mode, and the capacity of the free physical unit in the designated threshold is set to a larger value, so that sufficient storage space can be arranged to sequentially write the large file data.

[0044] Figure 5 is a schematic diagram of a data consolidation process in the second mode according to an embodiment. Figure 5, entity units 501 to 504 are shown here, wherein entity units 501 to 503 contain valid data and invalid data, and entity unit 504 contains invalid data. Each entity unit 501 to 504 has some small fragmented storage space. When the host system 11 wants to write a large amount of data to be written and requires sequential writing, although there is enough space in entity 2 units 501 to 504 to store the data to be written, the continuous storage space is insufficient. In the default mode, since the remaining storage space is greater than the specified threshold in the default mode, the data consolidation program cannot be triggered to release new entity units. Therefore, the first parameter of register 104 can be modified to execute the second mode, and the capacity of the idle entity unit is used as the condition for triggering the data consolidation program. After the data consolidation program is performed, the valid data is stored in entity units 511 and 512, and entity units 503 and 504 become idle entity units. At this time, there are enough idle entity units to meet the needs of sequential writing.

[0045] In one embodiment, when the designated mode belongs to the first mode or the second mode, the data consolidation program will be switched to the default mode after execution. Since the data consolidation program is executed according to the proportion of valid data in the first mode, many idle physical units have been released after execution. If the first mode is maintained, the data consolidation program may continue to be executed even if there are sufficient idle physical units, which in turn causes unnecessary data movement. Switching to the default mode can avoid such a phenomenon. In addition, in the second mode, whether to execute the data consolidation program is determined based on the capacity of the idle physical units. Similarly, if the second mode is maintained, the data consolidation program may be continuously executed when the specified threshold is large, or the data consolidation program may not be executed when the specified threshold is small. Switching to the default mode can avoid such a phenomenon.

[0046] Figure 6 is a flow chart of a method for selecting a mode for data consolidation according to an embodiment. Figure 6 , steps 601 to 604 are executed by the memory controller 103 and will not be described in detail below.

[0047] In step 601, in response to the first parameter of register 104 being updated, the default mode is switched to the specified mode. In step 602, the second parameter of register 104 is read to determine the specified threshold. In step 603, the state information of the entity unit is obtained according to the specified mode. The first parameter, the default mode, the second parameter, the specified threshold, the specified mode, and the state information have been described in detail above and will not be repeated here.

[0048] In step 604, if the state information of the entity unit meets the specified threshold, a data consolidation program is executed on the memory according to the specified mode. Here, "satisfying the specified threshold" may mean less than, equal to, or greater than the specified threshold, or when the specified threshold represents a range, "satisfying the specified threshold" may also mean within or outside the range. Since the state information of the entity unit is obtained according to the specified mode, when the state information meets the specified threshold, it also represents different situations. At this time, the data consolidation program can be executed according to the specified mode, and some attributes of the data consolidation program (such as order, time, source or target) may be different in different modes.

[0049] In the above embodiment, the user decides which mode to switch to, but in other embodiments, the host system 11 may also decide which mode to switch to independently. Figure 7 is a flow chart of a method for selecting a mode for data consolidation according to another embodiment. Figure 7 , steps 701 to 704 are executed by the host system 11 and will not be repeated below.

[0050] In step 701, the state information of the physical unit in the memory is obtained according to the data to be written. When the characteristics of the data to be written (such as data size, whether it is sequential writing, how many pieces of data to be written, etc.) are different, the host system 11 will select different preset modes, and thus obtain different state information.

[0051] In step 702, it is determined whether the memory satisfies the write condition of the data to be written according to the state information. For example, the write condition of the data to be written includes whether the memory includes sufficient continuous write space, or the write condition may also be whether the memory includes sufficient storage space (not necessarily continuous).

[0052] If the write condition is not met, in step 703, a mode instruction is sent to update register 104 to switch the default mode of memory controller 103 to the specified mode. Generally, memory controller 103 operates in the default mode. When the write condition is not met, it means that the default mode is not suitable for the data to be written, so the mode needs to be switched to the specified mode.

[0053] If the write condition is met, the default mode is selected in step 704. For example, a mode instruction is sent to update register 104 to switch memory controller 103 from other modes to the default mode. Alternatively, no mode instruction may be sent to allow memory controller 103 to operate in the default mode.

[0054] For example, when there are multiple consecutive data to be written, if the current remaining storage space is close to the threshold, the data consolidation program may be repeatedly triggered during the writing process, affecting the speed of writing data. In order to avoid this situation, it is suitable to switch to the first mode at this time, and the used storage space of all physical units in the memory can be obtained. When the sum of the used storage space and the storage space required for the multiple data to be written is greater than the specified threshold, the host system 11 will send a mode instruction to update the first parameter and the second parameter of the register 104, so that the first parameter is the first preset value, so as to switch the default mode of the memory controller 103 to the first mode. In the first mode, the valid data ratio of the physical unit is used as the condition for triggering data consolidation, and the physical unit with less valid data can be preferentially recovered, and a large amount of storage space can be released more quickly than the default mode.

[0055] In addition, when the data to be written is written sequentially, a large amount of continuous storage space is required, such as Figure 5 Therefore, the host system 11 obtains the capacity of the idle physical unit of the memory 102. In response to the capacity of the idle physical unit being less than the data to be written, the host system 11 sends a mode instruction to update the first parameter and the second parameter of the register 104, so that the first parameter is the second preset value, so as to switch the default mode of the memory controller 103 to the second mode.

[0056] Through the above method and storage device, the host system can determine the data consolidation mode by itself in some special scenarios, avoiding the situation where the storage device has reduced performance or cannot operate normally in these scenarios. Alternatively, the user can adjust the data consolidation program according to their own needs and preferences, and can also adjust the specified threshold, so that the user can choose different recycling strategies to balance the device life and performance, and use the optimal garbage collection strategy even in special scenarios.

[0057] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A memory controller, characterized in that: The memory controller is electrically connected to a memory and a register, wherein the memory includes a plurality of physical units, and the memory controller is used to perform a plurality of steps: In response to the first parameter of the register being updated, switching the default mode to the specified mode; reading a second parameter of the register to determine a specified threshold; Acquire the state information of the entity unit according to the specified mode; as well as If the state information of the physical unit meets the specified threshold, a data consolidation procedure is performed on the memory according to the specified mode.

2. The memory controller according to claim 1, wherein: The steps performed also include: A mode instruction is received to modify the register, and the first parameter and the second parameter of the register are updated.

3. The memory controller according to claim 1, wherein: The specified mode belongs to one of a plurality of preset modes, wherein the plurality of preset modes include a first mode, a second mode and the default mode, wherein the step of acquiring the state information of the entity unit according to the specified mode comprises: When the first parameter is a first preset value and the specified mode belongs to the first mode, first state information is acquired; When the first parameter is a second preset value and the specified mode belongs to the second mode, obtaining second state information; and When the first parameter is a third preset value, the designated mode belongs to the default mode, and third state information is acquired, wherein the first state information, the second state information and the first state information are different from each other.

4. The memory controller according to claim 1, wherein: After the step of executing the data consolidation procedure according to the specified mode, the step further includes: After executing the data consolidation procedure, switch back to the default mode.

5. The memory controller according to claim 3, wherein: The first status information includes the proportion of valid data in each of the physical units, wherein the step of executing the data consolidation procedure according to the specified mode includes: When the designated mode belongs to the first mode, determining whether the proportion of the valid data is less than the designated threshold; and If yes, the corresponding physical unit is marked, and the data consolidation procedure is performed on the marked physical unit.

6. The memory controller according to claim 3, characterized in that: The second state information includes the capacity of the free physical unit, wherein the step of executing the data consolidation procedure according to the specified mode includes: When the designated mode belongs to the second mode, determining whether the capacity of the idle entity unit is less than the designated threshold; and If so, the data consolidation procedure is executed until the capacity of the idle physical unit is not less than the specified threshold.

7. The memory controller according to claim 1, wherein: When in the default mode, the plurality of steps further include: Acquire third state information of the entity unit according to the default mode, wherein the third state information includes remaining storage space of all the entity units; Determining whether the remaining storage space is less than a default threshold; and If so, the data consolidation procedure is executed until the remaining storage space is not less than the default threshold.

8. A data storage system, characterized in that: include: A memory including a plurality of physical units; a register, comprising a first parameter and a second parameter, receiving a mode instruction to modify the first parameter and the second parameter; as well as a memory controller connected to a host system, the register and the memory, The host system is used to perform multiple steps: Acquire the state information of the physical unit in the memory according to the data to be written; Determining whether the memory satisfies a writing condition for the data to be written according to the state information; as well as If the write condition is not satisfied, a mode instruction is sent to update the register to switch the default mode of the memory controller to a specified mode.

9. The data storage system according to claim 8, characterized in that: The multiple steps include: When there are multiple consecutive data to be written, obtaining the used storage space of all the physical units of the memory; In response to the sum of the used storage space and the storage space required by the plurality of data to be written being greater than a specified threshold, sending the mode instruction to update the first parameter and the second parameter of the register; wherein The first parameter of the register is updated to a first preset value to switch the default mode of the memory controller to a first mode.

10. The data storage system according to claim 8, characterized in that: The multiple steps include: When the data to be written is written sequentially, obtaining the capacity of the idle physical unit of the memory; In response to the capacity of the idle physical unit being smaller than the data to be written, sending the mode instruction to update the first parameter and the second parameter of the register; and The first parameter of the register is updated to a second preset value to switch the default mode of the memory controller to a second mode.

11. The data storage system according to claim 8, characterized in that: The memory controller is used to perform a plurality of steps, including: In response to the first parameter of the register being updated, switching the default mode to the specified mode; reading the second parameter of the register to determine a specified threshold; Acquire the state information of the entity unit according to the specified mode; If the state information of the physical unit meets the specified threshold, a data consolidation procedure is performed on the memory according to the specified mode.

12. The data storage system according to claim 11, characterized in that: The steps performed by the memory controller also include: A mode instruction is received to modify the register, and the first parameter and the second parameter of the register are updated.

13. The data storage system according to claim 11, characterized in that: The specified mode belongs to one of a plurality of preset modes, wherein the plurality of preset modes include a first mode, a second mode and the default mode, wherein the step of acquiring the state information of the entity unit according to the specified mode comprises: When the first parameter is a first preset value and the specified mode belongs to the first mode, first state information is acquired; When the first parameter is a second preset value and the specified mode belongs to the second mode, obtaining second state information; and When the first parameter is a third preset value, the designated mode belongs to the default mode, and third state information is acquired, wherein the first state information, the second state information and the first state information are different from each other.

14. The data storage system according to claim 11, characterized in that: After the step of executing the data consolidation procedure according to the specified mode, the plurality of steps executed by the memory controller further include: After executing the data consolidation procedure, switch back to the default mode.

15. The data storage system according to claim 13, characterized in that: The first status information includes the proportion of valid data in each of the physical units, wherein the step of executing the data consolidation procedure according to the specified mode includes: When the designated mode belongs to the first mode, determining whether the proportion of the valid data is less than the designated threshold; and If yes, the corresponding physical unit is marked, and the data consolidation procedure is performed on the marked physical unit.

16. The data storage system according to claim 13, characterized in that: The second state information includes the capacity of the free physical unit, wherein the step of executing the data consolidation procedure according to the specified mode includes: When the designated mode belongs to the second mode, determining whether the capacity of the idle entity unit is less than the designated threshold; and If so, the data consolidation procedure is executed until the capacity of the idle physical unit is not less than the specified threshold.

17. The data storage system according to claim 11, characterized in that: When the memory controller is in a default mode, the steps performed by the memory controller further include: Acquire third state information of the entity unit according to the default mode, wherein the third state information includes remaining storage space of all the entity units; Determining whether the remaining storage space is less than the specified threshold; and If so, the data consolidation procedure is executed until the remaining storage space is not less than the specified threshold.

Citation Information

Patent Citations

  • Data storage method, memory storage device, and memory control circuit unit

    CN109471806A

  • Memory control method, memory storage device and memory controller

    CN112988068A

  • Performing media management operations based on changing write modes of data blocks in cache

    CN114981785A

  • Memory management method, memory control circuit unit and memory storage device

    US20190012080A1

  • Memory system and memory system control method

    US20220300190A1