A flash memory, a storage medium conversion method, and a computing device
By introducing storage media with different performances into flash memory and using controller dynamic conversion, the problems of insufficient storage space and low performance are solved, and storage space expansion and performance improvement are achieved, meeting users' high throughput and low latency needs.
Patent Information
- Application Number
- CN202010616867.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-06-20
- Filing Date
- 2020-06-30
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2040-06-30
AI Technical Summary
Flash memory often faces insufficient storage space or low performance during use, which is difficult to meet users' high throughput and low latency requirements.
By introducing storage media of different performances in flash memory, hot and cold data are stored partitions, and dynamically converting the storage media through the controller to expand capacity or improve performance, such as converting the first storage media into other storage media with a larger or smaller number of bits to increase storage space or improve data processing performance.
It effectively solves the problems of insufficient storage space and low performance, extends the life of flash memory, and improves data read and write speed and error rate, meeting users' high throughput and low latency requirements.
Smart Images

Figure CN113821158B_ABST
Abstract
Description
[0001] This application claims the priority of a Chinese patent application titled "A Flash Memory Partitioning Method and Device" with an application number of 202010569769.0 and filed with the China National Intellectual Property Administration on June 20, 2020. The entire content of which is incorporated herein by reference. Technical Field
[0002] This field relates to the storage field, and particularly to a flash memory, a storage medium conversion method, and a computing device. Background Art
[0003] With the continuous upgrade of the digital economy and the successive applications of technologies such as industrial Internet and 5G, the industrial community has an increasingly large demand for the scale of data storage and an increasingly urgent demand for high-throughput and low-latency storage. Therefore, technical personnel have been working hard to improve the read / write speed and storage efficiency of storage devices. Compared with the mechanical hard disk (HDD) with a relatively low read / write speed and excessive noise during operation, the flash memory with a faster read / write speed has gradually become the preferred choice.
[0004] However, the storage space of the flash memory is not infinite, and the performance may not be the highest, which makes it inevitable that the flash memory will encounter situations where the storage space is insufficient or the performance cannot meet the user's needs during use. Therefore, there is an urgent need to propose a solution to solve the problems of insufficient storage space or low performance that occur during the use of the flash memory. Summary of the Invention
[0005] Embodiments of this application provide a flash memory, a storage medium conversion method, and a computing device to solve the problems of insufficient storage space or low performance that occur during the use of the flash memory.
[0006] In a first aspect, an embodiment of the present application provides a flash memory, which may include a controller, a first storage medium, and a second storage medium. Of course, the flash memory may also include more other storage media, etc. Among them, the first storage medium is used to store hot data (such as frequently accessed data), and the second storage medium is used to store cold data (such as infrequently accessed data), and the number of bits stored in each storage unit in the first storage medium is less than the number of bits stored in each storage unit in the second storage medium. Accordingly, the data read and write performance of the first storage medium is usually higher than the data read and write performance of the second storage medium; and the controller can be used to convert part or all of the first storage medium, for example, the first storage medium can be converted into other storage media with lower data read and write performance, or the first storage medium can be converted into other storage media with higher data read and write performance, etc. Since the controller can control the conversion of the first storage medium into other storage media, when the flash memory is short of storage space during use, the capacity of the flash memory can be expanded by converting the first storage medium into other storage media with a larger number of bits stored in each storage unit, thereby increasing the storage space of the flash memory. When the flash memory has low performance during use, the performance of the flash memory can be improved by converting the first storage medium into other storage media with a smaller number of bits stored in each storage unit, thereby improving the data reading and writing performance of the flash memory.
[0007] In addition, by placing cold data and hot data in storage media with different performance for partitioned storage, the data blocks for garbage collection may not contain cold data, so that cold data will not be moved during the garbage collection process of the data blocks. While avoiding write amplification as much as possible, the problem of increased wear of other data blocks caused by write amplification can also be avoided, thereby extending the life of the flash memory.
[0008] In a possible implementation, the controller in the flash memory is also used to convert part or all of the second storage medium. In this implementation, the controller can also convert the second storage medium into other storage media with relatively low data read and write performance, thereby expanding the storage space of the flash memory; or convert the second storage medium into other storage media with relatively high data read and write performance, thereby improving the data read and write performance of the flash memory.
[0009] In a possible implementation, when the remaining storage space of the flash memory is lower than the first space threshold or the storage space utilization rate of the flash memory exceeds the first utilization rate threshold, it indicates that the available storage space of the flash memory is less. At this time, the controller can convert some or all of the first storage medium into a third storage medium, and the number of bits that each storage unit in the third storage medium can store is greater than the number of bits that each storage unit in the first storage medium can store. Since the number of bits that each storage unit can store increases after converting the first storage medium into the third storage medium, for the same number of storage units, the third storage medium can store more data than the first storage medium. Thus, the available storage space of the flash memory can be increased, alleviating the problem of insufficient storage space. Exemplarily, the third storage medium can be the second storage medium or other storage media different from the second storage medium. Alternatively, the controller can also convert some or all of the second storage medium into a fourth storage medium, and the number of bits that each storage unit in the fourth storage medium can store is greater than the number of bits that each storage unit in the second storage medium can store. Similarly, for the same number of storage units, the fourth storage medium can store more data than the second storage medium. Thus, the available storage space of the flash memory can also be increased. Exemplarily, when the storage space of the flash memory is insufficient, only the first storage medium or only the second storage medium can be converted, or both the first storage medium and the second storage medium can be converted simultaneously.
[0010] In a possible implementation, when the available storage space of the flash memory is relatively large, such as when its remaining storage space exceeds the first space threshold / the storage space utilization rate is lower than the first utilization rate threshold, or when the data processing performance of the flash memory is relatively low, such as when the error rate during data reading and writing exceeds the error rate threshold / the access speed during data access is lower than the access speed threshold, the data processing performance of the flash memory can be improved by converting the storage medium. Specifically, the controller can convert some or all of the first storage medium into a fifth storage medium, where the number of bits stored in each storage unit in the fifth storage medium is less than the number of bits stored in each storage unit in the first storage medium, that is, the data processing performance of the fifth storage medium is higher than that of the first storage medium. In this way, the flash memory can have a higher speed for data reading and writing based on the fifth storage medium, and a lower error rate for data reading and writing, thereby improving the data processing performance of the flash memory. Similarly, the controller can also convert some or all of the second storage medium into a sixth storage medium, where the number of bits that each storage unit in the sixth storage medium can store is less than the number of bits that each storage unit in the second storage medium can store, that is, the data processing performance of the sixth storage medium is higher than that of the second storage medium. Thus, compared with the data processing method of the flash memory based on the second storage medium, the performance of the flash memory during data processing based on the sixth storage medium can be higher, thereby improving the data processing performance of the flash memory. Exemplarily, the sixth storage medium can be the first storage medium or other storage media different from the first storage medium. Exemplarily, it can be to convert only the first storage medium or only the second storage medium to improve the data processing performance of the flash memory, or to convert both the first storage medium and the second storage medium simultaneously to improve the data processing performance of the flash memory.
[0011] In a possible implementation, when the storage space for storing hot data is insufficient, for example, when the remaining storage space of the first storage medium is lower than the second space threshold, or when the storage space utilization rate of the first storage medium exceeds the second utilization rate threshold, the controller can convert some or all of the second storage medium into the first storage medium to increase the storage space of the first storage medium, that is, to increase the storage space for storing hot data. Alternatively, the controller can also convert some or all of the first storage medium into the seventh storage medium, where the number of bits stored in each storage unit in the seventh storage medium is greater than the number of bits stored in each storage unit in the first storage medium and less than the number of bits stored in each storage unit in the second storage medium. The converted seventh storage medium is used to store hot data. Since the same number of storage units can store more data in the seventh storage medium than in the first storage medium, the storage space for storing hot data can be increased after converting the first storage medium into the seventh storage medium. Alternatively, the controller can also convert some or all of the second storage medium into the seventh storage medium. For example, when the second storage medium has more free storage space, some of the storage media corresponding to the storage space can be converted into the seventh storage medium so that the storage space for storing hot data can be increased. It should be noted that in practical applications, the storage space for hot data can be increased by any one of the above three conversion methods for storage media, or by a combination of multiple methods. For example, the controller can convert the first storage medium into the seventh storage medium and at the same time convert the second storage medium into the seventh storage medium, etc.
[0012] In a possible implementation, when the storage space for storing cold data is insufficient, for example, when the remaining storage space of the second storage medium is lower than the third space threshold, or when the storage space utilization rate of the second storage medium exceeds the third utilization rate threshold, the controller can convert some or all of the first storage medium into an eighth storage medium, where the number of bits that each storage unit in the eighth storage medium can store is greater than the number of bits that each storage unit in the first storage medium can store, and the converted eighth storage medium is used to store cold data. In this way, the storage space for storing cold data includes not only the storage space provided by the second storage medium but also the storage space provided by the eighth storage medium, thereby increasing the storage space for cold data and alleviating the problem of insufficient storage space for cold data. Among them, the eighth storage medium can be the second storage medium or a storage medium different from the second storage medium. Alternatively, the controller can also convert some or all of the second storage medium into a ninth storage medium, where the number of bits stored by each storage unit in the ninth storage medium is greater than the number of bits stored by each storage unit in the second storage medium, and the ninth storage medium is used to store cold data. Since the same number of storage units can store more data in the ninth storage medium than in the second storage medium, after converting the second storage medium into the ninth storage medium, the storage space for storing cold data can be increased, thus alleviating the problem of insufficient storage space for cold data in the flash memory. Exemplarily, the controller can convert only the first storage medium or the second storage medium to increase the storage space for cold data, or can convert both the first storage medium and the second storage medium simultaneously to increase the storage space for cold data, such as converting the first storage medium into the eighth storage medium and the second storage medium into the ninth storage medium simultaneously.
[0013] In a possible implementation, the above-mentioned hot data may refer to data whose access frequency exceeds a first frequency threshold, and / or data carrying a hot attribute identifier. In this way, the controller can determine whether the data is hot data based on whether the frequency (or frequency count) of the data being accessed in the flash memory exceeds the first frequency threshold (or the corresponding frequency threshold), or the controller can determine whether the data is hot data based on whether the data carries a hot attribute identifier. Similarly, the above-mentioned cold data may refer to data whose access frequency is lower than the first frequency threshold, and / or data carrying a cold attribute identifier. In this way, the controller can determine whether the data is cold data based on whether the frequency (or frequency count) of the data being accessed in the flash memory is lower than the second frequency threshold (or the corresponding frequency threshold), or the controller can determine whether the data is cold data based on whether the data carries a cold attribute identifier. In other possible implementations, it can also be determined according to the file type to which the data belongs. For example, for text-type data, since it is usually highly likely to be accessed and modified, the text-type data can be stored as hot data in the first storage medium. For audio / video-type data, since it is usually less likely to be accessed, the audio / video-type data can be stored as cold data in the second storage medium. Of course, the specific implementation method for determining hot and cold data in this application is not limited, and other possible methods can also be used to determine hot and cold data, etc.
[0014] In a possible implementation, the flash memory may further include a tenth storage medium, which can be used to store warm data. Each storage unit in the tenth storage medium can store a larger number of bits than each storage unit in the first storage medium and a smaller number of bits than each storage unit in the second storage medium. That is, the data read / write speed of the tenth storage medium can be between that of the first storage medium and the second storage medium. Exemplarily, the warm data may be data whose access frequency is lower than the first frequency threshold and exceeds the second frequency threshold, and / or data carrying a warm attribute identifier. In this way, partitioned storage and management of cold data, hot data, and warm data can be achieved.
[0015] In a possible implementation, the controller may convert the storage medium based on the received conversion instruction. For example, a user may send a conversion instruction for the first storage medium and / or the second storage medium to the flash memory through an external device connected to the flash memory. The conversion instruction may be used to indicate a storage medium conversion of the flash memory. Then, the controller may respond to the conversion instruction and convert part or all of the first storage medium into the second storage medium, or convert part or all of the second storage medium into the first storage medium. Exemplarily, the conversion instruction may also carry an identifier of the target storage medium and an identifier of the storage medium to be converted. In this way, the controller may determine whether to convert the first storage medium or the second storage medium according to the identifier of the storage medium to be converted in the conversion instruction, and determine to convert the first storage medium or the second storage medium into the target storage medium according to the identifier of the target storage medium in the conversion instruction.
[0016] In a possible implementation, the controller may also determine the part to be converted in the first storage medium before performing the storage medium conversion, and migrate the data stored in the part to be converted to the unconverted part in the first storage medium for storage. In this way, it is possible to avoid as much as possible the loss of some data stored in the first storage medium during the conversion of the first storage medium, that is, to avoid as much as possible the loss of the data stored in the part to be converted. Similarly, when the controller converts the second storage medium, it may also migrate the data in the part to be converted in the second storage medium to the unconverted part in the second storage medium for storage, so as to avoid as much as possible the loss of data in the second storage medium during the storage medium conversion.
[0017] In a possible implementation, the first storage medium may be any one of SLC, MLC, TLC, and QLC, and the second storage medium may be any one of MLC, TLC, QLC, and PLC. Of course, the number of bits that each storage unit in the first storage medium can store is less than the number of bits that each storage unit in the second storage medium can store, and the first storage medium and the second storage medium are not of the same type of storage medium. Specifically, the first storage medium is SLC and the second storage medium is MLC, TLC, QLC, or PLC; or the first storage medium is SLC or MLC and the second storage medium is TLC, QLC, or PLC; or the first storage medium is SLC, MLC, or TLC and the second storage medium is QLC or PLC; or the first storage medium is SLC, MLC, TLC, or QLC and the second storage medium is PLC.
[0018] In a possible implementation, the controller may also determine the file type of the target data to be written to the flash memory, and write the target data as hot data to the first storage medium according to the corresponding relationship between the file type and the first storage medium. Of course, if it is determined that the file type of the target data to be written to the flash memory corresponds to other storage media, such as the second storage medium, the target data may be written to other storage media. For example, since text-type data may be frequently accessed by users, text-type data may be stored as hot data in the first storage medium.
[0019] In a possible implementation, when determining the file type of the target data to be written to the flash memory, the controller may specifically read the superblock of the file system to which the target data belongs to obtain the attribute information of the file system; then, determine the file type of the target data according to the attribute information of the file system. In this implementation, the controller determines the file type of the target data by reading the superblock of the file system, which can realize the automatic recognition of the file type of the target data by the controller without the intervention of the upper-layer user, so that the user is unaware.
[0020] In a possible implementation, the controller may also be used to establish the corresponding relationship between the first storage medium and the file type in response to the user configuration parameters for the first storage medium. In this implementation, the user may configure the data written to the first storage medium as data belonging to which file types, so that the partition storage method of the flash memory for hot and cold data is more in line with the user's usage habits.
[0021] In a possible implementation, the controller is also used to migrate the data in the first storage medium whose access frequency is lower than the first frequency threshold to the second storage medium. Since the user's access behavior to the data in the first storage medium is not fixed, some data in the first storage medium may be frequently accessed by the user, while another part of the data may gradually not be accessed by the user. Therefore, the controller can monitor the access frequency of each data in the first storage medium, and thus migrate the data whose access frequency is lower than the first frequency threshold out of the first storage medium and no longer save it as hot data. Exemplarily, this part of the data may be saved as cold data in the second storage medium. Of course, this part of the data may also be saved as warm data in the tenth storage medium, and this embodiment does not limit this.
[0022] In a second aspect, an embodiment of the present application further provides a storage medium conversion method, which can be applied to a controller in a flash memory. The flash memory can at least include a controller, a first storage medium, and a second storage medium. The first storage medium can be used to store hot data that is frequently accessed, and the second storage medium can be used to store cold data that is not frequently accessed. Moreover, the number of bits stored in each storage unit in the first storage medium is less than the number of bits stored in each storage unit in the second storage medium. The method can include: the controller converting part or all of the first storage medium; or, the controller converting part or all of the second storage medium.
[0023] In a possible implementation, the controller converting part or all of the first storage medium includes: when the remaining storage space of the flash memory is lower than a first space threshold or the storage space utilization rate of the flash memory exceeds a first utilization rate threshold, the controller converts part or all of the first storage medium into a third storage medium, and the number of bits stored in each storage unit in the third storage medium is greater than the number of bits stored in each storage unit in the first storage medium; the controller converting part or all of the second storage medium includes: when the remaining storage space of the flash memory is lower than a first space threshold or the storage space utilization rate of the flash memory exceeds a first utilization rate threshold, converting part or all of the second storage medium into a fourth storage medium, and the number of bits stored in each storage unit in the fourth storage medium is greater than the number of bits stored in each storage unit in the second storage medium.
[0024] In a possible implementation, the controller converting part or all of the first storage medium includes: when the remaining storage space of the flash memory exceeds a first space threshold, or the storage space utilization rate of the flash memory is lower than a first utilization rate threshold, or the error rate of the flash memory exceeds an error rate threshold, or the access speed of the flash memory is lower than an access speed threshold, the controller converts part or all of the first storage medium into a fifth storage medium, and the number of bits stored in each storage unit in the fifth storage medium is less than the number of bits stored in each storage unit in the first storage medium; the controller converting part or all of the second storage medium includes: when the remaining storage space of the flash memory exceeds a first space threshold, or the storage space utilization rate of the flash memory is lower than a first utilization rate threshold, or the error rate of the flash memory exceeds an error rate threshold, or the access speed of the flash memory is lower than an access speed threshold, converting part or all of the second storage medium into a sixth storage medium, where the number of bits stored in each storage unit in the sixth storage medium is less than the number of bits stored in each storage unit in the second storage medium.
[0025] In a possible implementation, the controller converts part or all of the first storage medium, including: when the remaining storage space of the first storage medium is lower than a second space threshold or the storage space utilization rate of the first storage medium exceeds a second utilization rate threshold, the controller converts part or all of the first storage medium into a seventh storage medium, where the number of bits stored in each storage unit in the seventh storage medium is greater than the number of bits stored in each storage unit in the first storage medium and less than the number of bits stored in each storage unit in the second storage medium, and the seventh storage medium is used to store hot data; the controller converts part or all of the second storage medium, including: when the remaining storage space of the first storage medium is lower than a second space threshold or the storage space utilization rate of the first storage medium exceeds a second utilization rate threshold, the controller converts part or all of the second storage medium into the first storage medium, or converts part or all of the second storage medium into the seventh storage medium.
[0026] In a possible implementation, the controller converts part or all of the first storage medium, including: when the remaining storage space of the second storage medium is lower than a third space threshold or the storage space utilization rate of the second storage medium exceeds a third utilization rate threshold, the controller converts part or all of the first storage medium into an eighth storage medium, where the number of bits stored in each storage unit in the eighth storage medium is greater than the number of bits stored in each storage unit in the first storage medium, and the eighth storage medium is used to store cold data; the controller converts part or all of the second storage medium, including: when the remaining storage space of the second storage medium is lower than a third space threshold or the storage space utilization rate of the second storage medium exceeds a third utilization rate threshold, the controller converts part or all of the second storage medium into a ninth storage medium, where the number of bits stored in each storage unit in the ninth storage medium is greater than the number of bits stored in each storage unit in the second storage medium, and the ninth storage medium is used to store cold data.
[0027] In a possible implementation, hot data includes data with an access frequency exceeding a first frequency threshold or data carrying a hot attribute identifier, and cold data includes data with an access frequency lower than a second frequency threshold or data carrying a cold attribute identifier.
[0028] In a possible implementation, the flash memory further includes a tenth storage medium, which is used to store warm data. The number of bits stored in each storage unit in the tenth storage medium is greater than the number of bits stored in each storage unit in the first storage medium and less than the number of bits stored in each storage unit in the second storage medium. Warm data includes data with an access frequency lower than the first frequency threshold and higher than the second frequency threshold or data carrying a warm attribute identifier.
[0029] In a possible implementation, the controller converts some or all of the first storage media, including: receiving a conversion instruction for instructing to perform a storage media conversion on the flash memory; in response to the conversion instruction, converting some or all of the first storage media into the second storage media; the controller converts some or all of the second storage media, including: receiving a conversion instruction for instructing to perform a storage media conversion on the flash memory; in response to the conversion instruction, converting some or all of the second storage media into the first storage media.
[0030] In a possible implementation, the method further includes: before performing the storage media conversion, the controller determines a part to be converted in the first storage media and migrates the data stored in the part to be converted to an unconverted part in the first storage media for storage.
[0031] In a possible implementation, the first storage media is SLC, and the second storage media is MLC, TLC, QLC or PLC; or, the first storage media is SLC or MLC, and the second storage media is TLC, QLC or PLC; or, the first storage media is SLC, MLC or TLC, and the second storage media is QLC or PLC; or, the first storage media is SLC, MLC, TLC or QLC, and the second storage media is PLC.
[0032] In a possible implementation, the method further includes: the controller determines the file type of the target data to be written into the flash memory; according to the correspondence between the file type and the first storage media, writes the target data into the first storage media.
[0033] In a possible implementation, the controller determines the file type of the target data to be written into the flash memory, including: the controller reads the super block of the file system to which the target data belongs to obtain the attribute information of the file system; determines the file type of the target data according to the attribute information of the file system.
[0034] In a possible implementation, the method further includes: the controller responds to a user configuration operation for the first storage media and establishes a correspondence between the first storage media and the file type.
[0035] In a possible implementation, the method further includes: the controller migrates the data in the first storage media with an access frequency lower than the first frequency threshold to the second storage media.
[0036] In a third aspect, an embodiment of the present application provides a computing device, including: a processor and a memory; the memory is used to store instructions, and when the device runs, the processor executes the instructions stored in the memory so that the device executes the storage medium conversion method in the second aspect or any implementation method of the second aspect. It should be noted that the memory may be integrated in the processor or independent of the processor. The device may further include a bus. Among them, the processor is connected to the memory through the bus. Among them, the memory may include a read-only memory and a random access memory.
[0037] In a fourth aspect, an embodiment of the present application further provides a readable storage medium, in which a program or instructions are stored, and when it runs on a computer, any storage medium conversion method in the above aspects is executed.
[0038] In a fifth aspect, an embodiment of the present application further provides a computer program product containing instructions, and when it runs on a computer, the computer executes any storage medium conversion method in the above aspects.
[0039] In addition, for the technical effects brought by any implementation manner in the second aspect to the fifth aspect, reference may be made to the technical effects brought by different implementation manners in the first aspect, which will not be elaborated here. Description of the Drawings
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiment descriptions. Obviously, the drawings in the following descriptions are only some embodiments recorded in the present application. For those of ordinary skill in the art, other drawings can also be obtained according to these drawings.
[0041] Figure 1 It is a schematic structural diagram of a flash memory;
[0042] Figure 2 It is a schematic diagram of garbage collection for data blocks;
[0043] Figure 3 It is a schematic diagram of a flash memory using ZNS technology;
[0044] Figure 4 It is a schematic diagram of the device principle of a flash memory;
[0045] Figure 5 It is a schematic diagram of the voltage distribution of storage cells;
[0046] Figure 6 It is a schematic structural diagram of a flash memory in an embodiment of the present application;
[0047] Figure 7Schematic flowchart of a storage medium conversion method in an embodiment of the present application;
[0048] Figure 8 Schematic diagram of converting a storage medium in an embodiment of the present application;
[0049] Figure 9 Another schematic diagram of converting a storage medium in an embodiment of the present application;
[0050] Figure 10 Another schematic diagram of converting a storage medium in an embodiment of the present application;
[0051] Figure 11 Another schematic diagram of converting a storage medium in an embodiment of the present application;
[0052] Figure 12 Schematic diagram of the structure of a solid-state drive in an embodiment of the present application;
[0053] Figure 13 Schematic diagram of the structure of a computing device in an embodiment of the present application. Detailed implementation manners
[0054] To make the above objects, features, and advantages of the present application more obvious and understandable, the following will exemplarily illustrate various non-limiting implementation manners in the embodiments of the present application with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0055] Figure 1 It is a schematic diagram of the structure of a flash memory. As Figure 1 shown, a flash memory, which can also be simply referred to as a flash, may include a controller (also referred to as a host controller) and a storage medium. Among them, the data stored in the storage medium can form multiple data blocks. Optionally, the flash memory may further include an interface. A flash is a form of electrically erasable programmable read-only memory that allows the memory to be erased or written multiple times during operation.
[0056] The interface is responsible for communicating with external devices (such as the host, etc.), receiving commands and related data sent by external devices. After being processed by the flash memory, the command finally returns the command status or data to the external device through the interface. Among them, the interface can be a serial advanced technology attachment (SATA) interface, a serial small computer system interface (SAS), or a peripheral component interconnect express (PCIe) interface, etc. Currently, the interface specification adopted by the flash memory is usually the non-volatile memory express (NVMe). As a communication protocol between the host and the flash memory, NVMe can achieve low-latency, high-performance, and low-power data transmission.
[0057] When the flash memory receives a write command and the data to be written from an external device through the interface, the data to be written is usually first cached in the random access memory (RAM) of the flash memory. Then the controller assigns storage space addresses to these data. When the cached data to be written accumulates to a certain amount, the controller can write the cached data to be written to the corresponding storage space according to the assigned addresses. Since the flash memory usually does not support overwrite writing, an erase operation can be performed first and then data can be written.
[0058] Specifically, when the user updates data, since the storage medium in the flash memory cannot perform overwrite writing operations, the new data is usually written in other locations, and the old data stored in the original location becomes expired data, forming invalid pages. As the data stored in the flash memory increases, more and more invalid pages will be generated in the storage space. This leads to that when the user needs to write a certain amount of data into the flash memory, the data blocks in the flash memory usually need to be garbage-collected first, so as to free up some free data blocks in the storage medium to store the data to be written. However, among the data blocks for garbage collection, there may be hot data and cold data. As Figure 2 shown, A, B, and C in data block x, and D, E, and F in data block y are all cold data, and the rest of the data in these two data blocks are hot data. Among them, since cold data is not often changed by users, this part of the data is often valid data and cannot be directly erased. Usually, before erasing the data block, the valid data in the data block is written into other data blocks. For example, A, B, and C in data block x and D, E, and F in data block y are written intoFigure 2 In the data block z shown, all the data in the data block is then erased so that the erased data block can be used to store the data that the user needs to write, and the valid data originally in the data block will not be lost. Therefore, during the process of writing data to the flash memory, since there will be some data migration during garbage collection of the data block, this results in the amount of data actually written in the flash memory exceeding the amount of data written by the user to the flash memory, which is called write amplification. Moreover, the hot data in the data block often causes the data block to be frequently garbage collected, and the cold data is unnecessarily migrated, resulting in additional write amplification; at the same time, the lifespan of the data block is limited, and the migration of cold data will increase the wear degree of other data blocks and reduce the lifespan of other data blocks, that is, reduce the lifespan of the flash memory.
[0059] To solve this problem, under the NVMe standard, the storage space of the flash memory can be divided into several independent logical spaces, each with an independent logical block address range, and each divided logical space is called a namespace (Name Space, NS). Further, zoned name spaces (ZNS) is a new technical solution recently standardized by the NVMe organization. This solution can enhance data storage management by dividing the storage space of the flash memory into multiple zones. Figure 3 is a schematic diagram of a flash memory using ZNS technology. As Figure 3 shown, the storage area of this flash memory is divided into multiple partitions. To better manage the data, each partition can store data with similar usage and access patterns, such as videos of types like music, videos, or images.
[0060] However, just partitioning the storage space of the flash memory and storing data according to the file type of the data still has some problems. On the one hand, there are still cold data and hot data in the same type of data, which causes Figure 3 the flash memory shown still faces write amplification caused by the frequent migration of cold data during garbage collection; on the other hand, the wear degree of the area where the frequently accessed data is located will be higher than that of the area where the infrequently accessed data is located, and Figure 3 the flash memory shown does not take this aspect into consideration.
[0061] At the same time, the storage space of flash memory is limited, and the performance of most flash memories is not the highest, which makes it inevitable that the flash memory will encounter insufficient storage space or performance that cannot meet user needs when in use. For example, when the flash memory stores a lot of data, it is difficult to support the writing of more data; for another example, the data read and write performance of the flash memory can meet the read and write speed requirements in some scenarios, but in other scenarios with higher read and write speed requirements, the data read and write performance of the flash memory may be relatively low and cannot meet the user needs in this scenario.
[0062] To this end, an embodiment of the present application provides a flash memory, which is at least used to solve the problem of insufficient storage space or low performance of the flash memory during use. Specifically, the flash memory may include at least a controller, a first storage medium and a second storage medium. Of course, the flash memory may also include three or more storage media, etc. Among them, the first storage medium is used to store hot data, that is, data that is frequently accessed and changed, and the second storage medium is used to store cold data, that is, data that is not frequently accessed. The number of bits stored in each storage unit in the first storage medium is less than the number of bits stored in each storage unit in the second storage medium. Under normal circumstances, the read and write performance of the first storage medium for data is higher than the read and write performance of the second storage medium for data, and the controller in the flash memory can be used to convert part or all of the first storage medium, for example, the first storage medium can be converted into a second storage medium with relatively low read and write performance, or the first storage medium can be converted into other storage media with relatively higher read and write performance. Since the controller can control the conversion of the first storage medium into other storage media, when the flash memory is short of storage space during use, the capacity of the flash memory can be expanded by converting the first storage medium into other storage media with a larger number of bits stored in each storage unit, thereby increasing the storage space of the flash memory. When the flash memory has low performance during use, the performance of the flash memory can be improved by converting the first storage medium into other storage media with a smaller number of bits stored in each storage unit, thereby improving the data reading and writing performance of the flash memory.
[0063] At the same time, by placing cold data and hot data in storage media with different performance for partitioned storage, the data blocks for garbage collection may not contain cold data, so that the cold data will not be moved during the garbage collection process of the data blocks. While avoiding write amplification as much as possible, the problem of increased wear of other data blocks caused by write amplification can also be avoided, thereby extending the life of the flash memory.
[0064] Before discussing a new technical solution provided by this application, it is first necessary to explain the principle of the storage medium. Figure 4 It is a schematic diagram of the device principle of a flash memory.
[0065] The storage medium in a flash memory can include multiple memory cells (Cells), and each memory cell is a double-layer floating-gate metal-oxide-semiconductor field-effect transistor (Floating-gate MOSFET, abbreviated as floating-gate MOSFET or FGMOS) of a type of N-type metal-oxide-semiconductor (N-Metal-Oxide-Semiconductor, NMOS).
[0066] FGMOS can be fabricated by insulating the gate of a standard MOSFET, so that there is no resistive connection between the gate of the MOSFET and the outside world through insulation. Then, multiple secondary gates or input electrodes are deposited above the floating gate and electrically isolated from it. Since the floating gate is completely surrounded by a high-resistance material, there is only capacitive coupling between the input electrode and the floating gate. As Figure 4 shown, the gate of FGMOS can be divided into 4 layers. From the substrate upwards, they are the insulating layer, the floating-gate layer, the insulating layer, and the control gate. Among them, the insulating layer connected to the substrate is generally called the tunnel oxide layer. FGMOS represents 0 or 1 by storing electrons in the floating-gate layer. When a write operation is performed, the flash memory applies a positive voltage to the control gate, so that electrons enter the floating gate through the tunnel oxide layer; while when an erase operation is performed, the flash memory applies a positive voltage to the substrate to suck out the electrons from the floating gate, making the FGMOS become the initial mode without stored electrons in the floating gate. The upper and lower layers of the floating gate are both insulating layers, which makes the electrons stored in the floating-gate layer not disappear due to the power-off of the flash memory. Therefore, flash memory is a non-volatile memory.
[0067] In different types of storage media, the number of bits stored in each storage cell is different. According to the number of bits that each storage cell can store, storage media can be classified into single-level cell (SLC), multi-level cell (MLC), trinary-level cell (TLC), quarter-level cell (QLC), penta-level cell (PLC), etc. For SLC, since each storage cell is used to store the value of one bit, that is to say, each storage cell needs to represent two states: 0 and 1. Then, it can be considered that when the number of electrons stored in the floating gate exceeds a certain preset value, the value represented by the storage cell is 1 currently; and when the number of electrons stored in the floating gate is less than a certain preset value, it is considered that the value represented by the storage cell is 0 currently. In specific operations, the controller can read the voltage of the storage cell to determine the bit value represented by the storage cell. Figure 5 is a schematic diagram of the voltage distribution of the storage cell. As Figure 5 shown, the horizontal axis of this voltage distribution schematic diagram is voltage, and the vertical axis is the number of storage cells. It can be seen that when representing the bit with the value of 0 or 1, not all storage cells have the same voltage, but an approximate normal distribution centered around a certain threshold voltage. When the controller reads data from the storage cell, when the sampled voltage of the storage cell falls within the voltage range of the value of 1, it is considered that the bit value represented by the storage cell is 1; when the sampled voltage of the storage cell falls within the voltage range of the value of 0, it is considered that the bit value represented by the storage cell is 0.
[0068] Similarly, for MLC, each storage cell can be used to store the value of two bits. Then each storage cell needs to be able to store 4 states, that is, divide the number of electrons in the floating gate or the voltage of the storage cell into 4 intervals, which are used to represent 00, 01, 10, and 11 respectively. For TLC, each storage cell can be used to store the value of three bits. Then each storage space needs to be able to store 8 states, that is, divide the number of electrons in the floating gate or the voltage of the storage cell into 8 intervals. By analogy, the principles of storing data for QLC and PLC can be obtained, which will not be elaborated in this application. In principle, the more bit values stored in each storage cell in the storage medium, the slower the read and write speed of the storage cell, and the fewer the number of erasable and writable times it can withstand.
[0069] Next, the flash memory provided by the embodiments of this application will be introduced in detail.
[0070] Refer to Figure 6, which is a schematic structural diagram of a flash memory in an embodiment of the present application. The flash memory may at least include a controller, a first storage medium, and a second storage medium. Moreover, the number of bits stored in each storage unit of the first storage medium is less than the number of bits stored in each storage unit of the second storage medium, that is, the amount of data that each storage unit in the second storage medium can store is more than the amount of data that can be stored in the first storage medium. However, generally, the read / write performance of the second storage medium is lower than that of the first storage medium, and the number of erasable times that the second storage medium can withstand is less than the number of erasable times that the first storage medium can withstand.
[0071] Among them, the first storage medium can be used to store hot data, which can refer to data that is frequently accessed and updated. The second storage medium can be used to store cold data, which can refer to data that is not frequently accessed. In this embodiment, the controller can first determine whether the data is hot data or cold data, and then write the data into the corresponding first storage medium or second storage medium according to the determined result. Exemplarily, when the first storage medium is the aforementioned SLC, the second storage medium can be the aforementioned MLC, TLC, QLC, or PLC; when the first storage medium is SLC or MLC, the second storage medium can be TLC, QLC, or PLC; when the first storage medium is SLC, MLC, or TLC, the second storage medium can be QLC or PLC; when the first storage medium is SLC, MLC, TLC, or QLC, the second storage medium can be PLC. Of course, the above examples are only for some illustrative purposes and are not used to limit the specific forms of the first storage medium and the second storage medium in actual applications to be limited to the above examples. It can also be other possible storage media, etc. This embodiment does not limit this.
[0072] For the hot data in the flash memory, since it may be frequently accessed, therefore, using the first storage medium with a faster read / write speed and more erasable times for storage can enable the flash memory to support the fast read / write of this hot data; for the cold data in the flash memory, since its access frequency is low, therefore, the second storage medium with a slower read / write speed and fewer erasable times can be used for storage. In this way, the flash memory can be more economical when storing hot and cold data using different storage media.
[0073] As an example of determining hot and cold data, when data is written to a flash memory, the controller can detect the attribute identifier of the data. This attribute identifier may be a hot attribute identifier or a cold data identifier. If the controller detects that the data carries a hot attribute identifier, it can determine that the data is hot data and write it to the first storage medium, specifically, write it to a data block in the first storage medium. If the controller detects that the data carries a cold attribute identifier, it can determine that the data is cold data and write it to a data block in the second storage medium. Further, the attribute identifier may also be a warm attribute identifier. And when the controller detects that the data carries a warm attribute identifier, it can determine that the data is warm data and write it to the storage medium corresponding to the warm data (hereinafter referred to as the tenth storage medium). At this time, the flash memory may further include the tenth storage medium. Regarding warm data, the frequency of its access is between that of hot data and cold data. And for the tenth storage medium storing this warm data, the number of bits that each storage unit can store is greater than the number of bits that each storage unit in the first storage medium can store, and less than the number of bits that each storage unit in the second storage medium can store. For example, the first storage medium may be SLC, the second storage medium may be TLC, and the tenth storage medium may be MCL between SLC and TLC. Or, for another example, the first storage medium may be MLC, the second storage medium is PLC, and the tenth storage medium may be TLC or QLC between MLC and PLC, etc. By storing data with different attributes in different storage media, the partition storage and management of cold data, hot data, and warm data in the flash memory can be realized, as Figure 6 shown.
[0074] In another example of determining hot and cold data, it can also be determined according to the file type corresponding to the data. For example, when storing text data in the flash memory, the text data can be regarded as hot data and stored in the first storage medium. When storing audio and video data in the flash memory, the audio and video data can be regarded as cold data and stored in the second storage medium. When storing picture data in the flash memory, the picture data can be regarded as warm data and stored in the above-mentioned ninth storage medium. Therefore, in this embodiment, when writing data to the flash memory, the controller can determine the file type of the target data to be written to the flash memory. If, by looking up the correspondence between the file type and the storage medium, it is determined that the file type of the target data corresponds to the first storage medium, then the target data can be written to the first storage medium. Of course, if it is determined that the file type of the target data corresponds to the second storage medium (or the tenth storage medium), then the target data can be written to the tenth storage medium.
[0075] In this embodiment, the controller can automatically identify the file type of the target data. As an example, when writing the target data to the flash memory, the controller can read the superblock of the file system to which the target data belongs, so as to obtain the attribute information of the file system saved in the superblock. Of course, other information (such as resource usage, etc.) may also be included in the superblock. The attribute information may include, for example, the category of the file system, the encoding format of the file, etc. Then, the controller can further determine the file type of the target data based on the attribute information of the file system, such as determining that the file type of the target data is a video file, a picture file, or a text file, etc. Exemplarily, the file system to which the target data belongs may be, for example, a file allocation table file system (FAT), a new technology file system (NTFS), a hierarchical file system (HFS), or an extended file system (EXT), etc. Of course, it may also be other file systems, and the present application does not limit this. In this way, the controller can automatically identify the file type of the target data without the intervention of the upper-layer user. Optionally, it may also be that the user performs relevant configuration operations to inform the controller of the file type to which the target data belongs. This embodiment does not limit the specific implementation manner for the controller to determine the file type of the target data.
[0076] In a further possible implementation, the correspondence between the file type and the storage medium can be specifically established based on the user's configuration operations. For example, the user can configure to determine that text files are stored in the first storage medium, audio and video files are stored in the second storage medium, picture files are stored in the tenth storage medium, etc. Thus, the controller can respond to the user's configuration operations for each storage medium to determine the correspondence between the storage medium and the file type, so as to determine which storage medium to write the data to based on this correspondence in the subsequent process. In another possible implementation, it may also be that the controller determines the first file type of the data with a higher access frequency or frequency and the second file type of the data with a lower access frequency or frequency according to the user's usage habits, and establishes the correspondence between the first file type and the first storage medium, and the correspondence between the second file type and the second storage medium. In this way, the controller can adjust the correspondence between the file type and each storage medium according to the change of the user's usage habits.
[0077] In yet another example of determining hot and cold data, when data is initially written into the flash memory, it may not be determined whether the data is hot data or cold data. Instead, the data can be stored in the first storage medium or the second storage medium of the flash memory first. For example, its position in the flash memory can be determined according to the correspondence between the above file types and storage media. Then, the controller can monitor the frequency (or frequency of access) of the data being accessed in the flash memory. When it is determined that the frequency of access to the data exceeds the first access frequency threshold, it can be considered that the data is frequently accessed and belongs to hot data, and the data is stored in the first storage medium. When it is determined that the frequency of access to the data is lower than the second access frequency threshold, it can be considered that the frequency of access to the data is low and belongs to cold data, and the data is stored in the second storage medium. Among them, the second access frequency threshold can be less than or equal to the first access frequency threshold. Further, when the second access frequency threshold is less than the first access frequency threshold, and the controller determines that the frequency of access to the data is between the first access frequency threshold and the second access frequency threshold, it can be determined that the data belongs to warm data.
[0078] It should be noted that in the flash memory, only the first storage medium may store hot data. When the flash memory further includes other storage media, the storage media for storing hot data may include other storage media in addition to the first storage medium, that is, multiple storage media may be used to store hot data, and this embodiment does not limit this. Similarly, in the flash memory, multiple storage media may also be used to store cold data, warm data, etc.
[0079] In this embodiment, the controller in the flash memory can convert the first storage medium or the second storage medium. Specifically, it can convert the first storage medium or the second storage medium into other storage media. For example, the first storage medium can be converted into the second storage medium or a storage medium different from the second storage medium; or the second storage medium can be converted into the first storage medium or a storage medium different from the first storage medium.
[0080] When converting between storage media, since the main difference between different storage media lies in the number of bits that each storage unit can store, and the basic principle of storing data is the same, the conversion between storage media can be achieved by adjusting the access mode of the storage media.
[0081] For ease of explanation, the following will take the conversion between SLC and MLC as an example to illustrate the conversion process between storage media. However, the present application is not limited to the conversion between these two storage media. When converting an MLC storage media to an SLC storage media, since the storage cells in the MLC have 4 electron number ranges or 4 voltage ranges, while the storage cells in the SLC only need to have 2 electron number ranges or 2 voltage ranges, therefore, the 4 electron number ranges or 4 voltage ranges in the MLC can be combined into 2 ranges, and the combined 2 ranges are respectively used to represent state 0 or 1. For example, the ranges previously divided for the number of electrons stored in the floating gate of the storage cells in the MLC are: the bit value represented by 0 - 10 electrons is "00"; the bit value represented by 11 - 20 electrons is "01"; the bit value represented by 21 - 30 electrons is "10", and the bit value represented by more than 31 electrons is "11"; and when this MLC is converted to an SLC, the ranges divided for the number of electrons stored in the floating gate of the storage cells can be: the bit value represented by 0 - 20 electrons is "0", and the bit value represented by 21 - 40 electrons is "1". On the contrary, if converting an SLC media to an MLC media, the 2 electron number ranges or 2 voltage ranges of the storage cells in the SLC media need to be further subdivided into 4 ranges, so as to enable each storage cell to represent 2 bit positions.
[0082] Similarly, when converting from SLC to TLC, since the storage cells in the TLC have 8 electron number ranges or 8 voltage ranges, therefore, the 2 electron number ranges or 2 voltage ranges of the storage cells in the SLC can be further subdivided into 8 ranges, so as to enable each storage cell to represent 3 bit positions. And so on, the present application will not elaborate on the conversion processes between the remaining storage media.
[0083] Hereinafter, some implementation scenarios for the controller to control the conversion of the first storage media and the conversion of the second storage media will be exemplarily described.
[0084] Scenario 1: The storage space of the flash memory is insufficient.
[0085] Generally, the larger the number of bit positions that each storage cell in the storage media can store, the more data the storage media can store. Therefore, for the above-mentioned flash memory using a hybrid storage media, when the storage space of the flash memory is insufficient, it can be to convert the storage media in the flash memory to a storage media that can store more data.
[0086] In specific implementation, the controller may determine the size relationship between the remaining storage space of the flash memory and a preset first space threshold, or determine the size relationship between the storage space utilization rate of the flash memory and a first utilization rate threshold. When the controller determines that the remaining storage space is lower than the first space threshold, or the storage space utilization rate exceeds the first utilization rate threshold, it indicates that the flash memory is about to or has already entered a state of insufficient storage space. At this time, the controller can increase the capacity of the flash memory by converting the storage medium. Exemplarily, the embodiments of the present application provide the following several methods for converting the storage medium:
[0087] (1) Convert some or all of the first storage medium to the third storage medium, where the number of bits stored in each storage unit of the third storage medium is greater than the number of bits stored in each storage unit of the first storage medium. Among them, the third storage medium may be the above-mentioned second storage medium, or a storage medium different from the second storage medium. For example, when the first storage medium is SLC and the second storage medium is MLC, the controller may convert some or all of the SLC to MLC, and thus the increased storage space after the SLC is converted to MLC is the storage space that the flash memory can increase; for another example, when the first storage medium is SLC and the second storage medium is MLC, the controller may convert some or all of the SLC to TLC (or convert to QLC, TLC, etc.).
[0088] (2) Convert some or all of the second storage medium to the fourth storage medium, where the number of bits that each storage unit of the fourth storage medium can store is greater than the number of bits that each storage unit of the second storage medium can store. For example, when the first storage medium is SLC and the second storage medium is MLC, some or all of the MLC can be converted to TLC, QLC, or PLC, etc.
[0089] It should be noted that the above several methods for converting the storage medium are only examples. In fact, there may be more methods for converting the storage medium, and combinations of several methods for converting the storage medium can be used simultaneously. For example, the first storage medium and the second storage medium are respectively converted to the third storage medium and the fourth storage medium at the same time, etc. The present application does not limit this. Similarly, the conversion between storage media in the following various scenarios is only taken as an example. In fact, there may also be more methods for converting the storage medium, and combinations of several methods for converting the storage medium can be used simultaneously. When describing the conversion between storage media below, this will not be elaborated further.
[0090] It should be noted that in this embodiment, when converting the first storage medium into another storage medium, it is usually necessary to erase the data currently stored in the converted part of the first storage medium. Therefore, to avoid loss of the data stored in the converted part of the first storage medium, in a further possible implementation, the data stored in this part of the first storage medium can be migrated. Specifically, before converting the first storage medium, the controller can determine the part to be converted in the first storage medium and migrate the data stored in the part to be converted to the unconverted part of the first storage medium for storage. In this way, it is possible to avoid, as much as possible, the loss of some of the data stored in the first storage medium during the conversion of the first storage medium.
[0091] Similarly, before converting the second storage medium, the controller can also migrate the data stored in the second storage medium to avoid, as much as possible, the loss of some of the data stored in the second storage medium. In addition, before converting the first storage medium and the second storage medium described below, the data can be migrated in a similar manner as above, and the process of data migration before converting the following storage media in this application will not be elaborated.
[0092] Scenario 2: The data processing performance of the flash memory needs to be improved.
[0093] Exemplarily, the data processing performance of the flash memory, such as the data read / write speed and / or error rate of the flash memory, etc. Of course, this embodiment does not limit this.
[0094] Under normal circumstances, the more bits that each storage cell in the storage medium can store, the more intervals are represented by the number of electrons stored in the floating gate of the storage cell of the storage medium, and the relatively higher the error rate of the interval where the number of electrons stored in the floating gate of the storage cell is located. For example, each storage cell in SLC only needs to store the value of one bit, so only two intervals need to be divided for the number of electrons in the floating gate or the voltage of the storage cell, representing 0 or 1 respectively; while each storage cell in QLC needs to store the value of 4 bits, so 16 intervals need to be divided for the number of electrons in the floating gate or the voltage of the storage cell, which makes the range of the number of electrons or the range of the voltage corresponding to each interval divided for QLC very narrow, thereby increasing the probability of the situation where the storage cell represents an incorrect bit value due to the floating gate sucking in too many or too few electrons.
[0095] Regarding the read and write speeds of storage media, the read and write speeds corresponding to different storage media in flash memory can be different. For example, the read time of SLC is approximately 25 us (microseconds), the write time is approximately 300 us, and the erase time is approximately 1500 us; the read time of MLC is approximately 50 us, the write time is approximately 600 us, and the erase time is approximately 3000 us; the read time of TLC is approximately 75 us, the write time is approximately 900 us, and the erase time is approximately 4500 us. That is, the read and write performance of SLC is better than that of MLC, and the read and write performance of MLC is better than that of TLC. That is to say, the more bits a storage cell represents, the slower the read and write speed; the fewer bits a storage cell represents, the faster the read and write speed.
[0096] The reason is that when a storage cell represents more bits, there are more intervals for the number of electrons in the floating gate of the storage cell or the voltage of the storage cell. Then, when writing, the number of electrons trying to enter the floating gate needs to be more precise, so the time consumed by the write operation is longer. On the other hand, when performing a read operation, different reference voltages need to be tried to read, which also increases the read time of the flash memory medium corresponding to the storage cell. Therefore, in terms of read and write performance, a storage medium with fewer bits represented by each storage cell is better than a storage medium with more bits represented by each storage cell.
[0097] In addition, since a storage medium with fewer bits represented by each storage cell has higher accuracy and better read and write performance compared to a storage medium with more bits represented by each storage cell, but only has a lower storage space. If the storage space utilization rate of the flash memory is low or the remaining storage space is high, it means that the storage space of the flash memory is sufficient for use, and the user has no requirements for the storage capacity of the flash memory at present. In this case, the controller can actively convert the storage medium in the flash memory into a storage medium with fewer bits represented by each storage cell, thereby improving the performance of the flash memory without affecting the user's use. Of course, in other possible implementation manners, it can also be an adaptive combination or adjustment of the above judgment conditions for determining to improve the performance of the flash memory, or other possible judgment conditions, etc., and this embodiment does not limit this.
[0098] Therefore, when improving the above data processing performance of the flash memory, it can be achieved by converting the storage medium into a storage medium with relatively higher data processing performance.
[0099] In specific implementation, the controller may determine whether the remaining storage space of the flash memory exceeds a first space threshold, or determine whether the storage space utilization rate of the flash memory is lower than a first utilization rate threshold, or determine whether the error rate of the flash memory exceeds an error rate threshold, or determine whether the access speed of the flash memory is lower than an access speed threshold. When the controller determines that the remaining storage space does not exceed the first space threshold, or the storage space utilization rate is not lower than the first utilization rate threshold, or the error rate exceeds the error rate threshold, or the access speed is lower than the access speed threshold, the overall data processing performance of the flash memory can be improved by converting the storage medium in the flash memory into a storage medium with higher data processing performance.
[0100] Exemplarily, the embodiments of the present application provide the following several methods for converting storage media:
[0101] (1) Convert some or all of the first storage media into fifth storage media, where the number of bits that each storage unit in the fifth storage media can store is less than the number of bits that each storage unit in the first storage media can store. That is, the data processing performance of the fifth storage media is higher than that of the first storage media. For example, when the first storage media is MLC, the controller can convert some or all of the MLC into SLC. After the MLC is converted into SLC, the read / write speed and error rate of the storage media can be improved, thereby improving the data processing performance of the flash memory.
[0102] (2) Convert some or all of the second storage media into sixth storage media, where the number of bits that each storage unit in the sixth storage media can store is less than the number of bits that each storage unit in the second storage media can store. That is, the data processing performance of the sixth storage media is higher than that of the second storage media. Among them, the sixth storage media can be the first storage media or other storage media different from the first storage media. For example, when the first storage media is MLC and the second storage media is TLC, the controller can convert some or all of the TLC into MLC, or the controller can convert some or all of the TLC into SLC with higher data processing performance than MLC, etc.
[0103] Scenario 3: Insufficient storage space for storing hot data.
[0104] In this embodiment, the first storage media in the flash memory can store hot data, and the second storage media can store cold data. When the first storage media does not have sufficient storage space to store hot data, the controller can increase the storage space for hot data by converting the storage media.
[0105] In specific implementation, the controller can determine whether the remaining storage space of the first storage medium is lower than the second space threshold, or determine whether the storage space utilization rate of the first storage medium exceeds the second utilization rate threshold. When the controller determines that the remaining storage space of the first storage medium is lower than the second space threshold or the storage space utilization rate exceeds the second utilization rate threshold, it can determine to convert the first storage medium or the second storage medium to increase the storage space for hot data. Among them, the second space threshold can be a preset fixed value or the data volume of the hot data to be written currently, that is, when the remaining storage space of the first storage medium is not enough to support storing all the currently to-be-written data, the expansion of the storage space for hot data can be performed.
[0106] Exemplarily, the embodiments of the present application provide the following several methods for converting storage media:
[0107] (1) Convert part or all of the second storage medium to the first storage medium. In this embodiment, when the remaining storage space of the second storage medium is large or the storage space utilization rate is low, part or all of the second storage medium can be converted to the first storage medium so that the storage space of the first storage medium can be increased to store new to-be-written hot data. For example, when the first storage medium is SML and the second storage medium is TLC, the controller can convert part of the TCL to SLC to increase the storage space of SLC.
[0108] (2) Convert part or all of the first storage medium to the seventh storage medium, where the number of bits that each storage unit in the seventh storage medium can store is greater than the number of bits that each storage unit in the first storage medium can store and less than the number of bits that each storage unit in the second storage medium can store. The converted seventh storage medium can be used to store hot data. Still taking the first storage medium as SML and the second storage medium as TLC as an example, the controller can convert part or all of the SML to MLC and use the MLC to store hot data. Since the number of bits that each storage unit in the MLC can store is relatively large, after converting the SLC to MLC, the storage space for hot data can be increased, and the TLC can continue to store cold data.
[0109] (3) Convert part or all of the second storage medium to the seventh storage medium in (2). Still taking the first storage medium as SML and the second storage medium as TLC as an example, the controller can convert part of the TLC to MLC and use the MLC to store hot data. At this time, both the SML and the MLC can be used to store hot data, thereby increasing the storage space for hot data.
[0110] Scenario 4: The storage space for storing cold data is insufficient.
[0111] In this embodiment, cold data can be stored in the second storage medium of the flash memory. When the second storage medium does not have sufficient storage space to store hot data, the controller can increase the storage space for cold data by converting the storage medium.
[0112] Specifically, the controller can determine whether the remaining storage space of the second storage medium is lower than the third space threshold, or determine whether the storage space utilization rate of the second storage medium exceeds the third utilization rate threshold. When the controller determines that the remaining storage space of the second storage medium is lower than the third space threshold or the storage space utilization rate exceeds the third utilization rate threshold, it can determine to convert the first storage medium or the second storage medium to increase the storage space for cold data.
[0113] Exemplarily, the embodiments of the present application provide the following several methods for converting the storage medium:
[0114] (1) Convert part or all of the first storage medium to the eighth storage medium. The number of bits stored in each storage unit of the eighth storage medium is greater than the number of bits stored in each storage unit of the first storage medium, and the eighth storage medium is used to store cold data. In this way, by converting the first storage medium to the eighth storage medium for storing cold data, the storage space for cold data can be increased. Among them, the eighth storage medium can be the second storage medium or a storage medium different from the second storage medium. At this time, the data read / write speed of the eighth storage medium can be higher than that of the second storage medium or lower than that of the second storage medium. For example, when the first storage medium is SLC and the second storage medium is TLC, the controller can increase the storage space of TLC for storing cold data by converting part of the SLC to TLC. At this time, the eighth storage medium is the same as the second storage medium, which is TLC; for another example, when the first storage medium is SLC and the second storage medium is TLC, the controller can convert part of the SLC to MLC and use the MLC to store cold data. At this time, the eighth storage medium is MLC, and its data read / write speed can be higher than that of the second storage medium TLC; for still another example, when the first storage medium is SLC and the second storage medium is TLC, the controller can convert part of the SLC to QLC and use the QLC to store cold data. At this time, the eighth storage medium is TLC, and its data read / write speed can be lower than that of the second storage medium QLC.
[0115] (2) Convert some or all of the second storage medium into a ninth storage medium, where the number of bits stored in each storage unit in the ninth storage medium is greater than the number of bits stored in each storage unit in the second storage medium, and the ninth storage medium is used to store cold data. For example, when the first storage medium is SLC and the second storage medium is TLC, the controller can convert some or all of the TLC into QLC (the ninth storage medium) and use the QLC to store cold data. Since the number of bits that each storage unit of QLC can store is relatively larger, after converting TLC into QLC, the storage space for cold data can be increased.
[0116] It should be noted that due to the conversion of the storage medium, the storage space for hot data and / or cold data will change. To adapt to this change, in a possible implementation solution of this application, the first access frequency threshold for determining whether data is hot data and the second access frequency threshold for determining whether data is cold data can be variable. By doing so, when the available capacity of the hot data area decreases, the value of the first access frequency threshold can be increased, so that less data is determined to be hot data, thereby reducing the amount of storage space required for hot data; at the same time, when the available capacity of the cold data area increases, the value of the second access frequency threshold can be increased, so that more data is determined to be cold data, thereby allowing cold data to occupy more storage space.
[0117] In the above Scenarios 1 to 4, the conversion between storage media can be automatically controlled by the controller, while in other possible scenarios, the conversion of the storage medium can also be based on an external conversion instruction (such as a user's conversion instruction).
[0118] Scenario 5: The external conversion instruction indicates to convert the storage medium.
[0119] In this scenario, the user can control the conversion of the storage medium of the flash memory. For example, when the user has no requirement for storage space but has requirements for the read / write speed and accuracy of data, the storage medium in the flash memory can be converted into a storage medium with fewer bits represented by each storage unit through a conversion instruction. Specifically, when implementing, the user (through a device connected to the flash memory) can send a conversion instruction to the flash memory, and this conversion instruction can be used to indicate the conversion of the storage medium of the flash memory; the flash memory can receive this conversion instruction through an interface as shown in Figure 1 and respond to it, converting some / all of the first storage medium into the second storage medium, or converting some / all of the second storage medium into the first storage medium, etc.
[0120] In other possible embodiments, the conversion instruction may further include the identifier of the storage medium to be converted and the identifier of the target storage medium to which it is to be converted. In this way, the controller can determine whether to convert the first storage medium or the second storage medium according to the identifier of the storage medium to be converted in the conversion instruction, and determine the target storage medium to which the first storage medium or the second storage medium is to be converted according to the identifier of the target storage medium in the conversion instruction. For example, assuming that the first storage medium is SLC, the second storage medium is MLC, and the conversion instruction may include the identifier of SLC and the identifier of TLC, the controller can determine to convert SLC to TLC, and the second storage medium MLC may not be converted.
[0121] In practical applications, the access frequency of the hot data stored in the first storage medium and the cold data stored in the second storage medium may change. For example, for some of the cold data stored in the second storage medium, the user may frequently access the cold data due to actual application needs, or for some of the hot data in the first storage medium, the access frequency decreases. At this time, this part of the cold data may not be suitable for continued storage in the second storage medium, and this part of the hot data may not be suitable for continued storage in the first storage medium. Therefore, in a further possible embodiment, the controller can also monitor the access frequency (or frequency) of each data in the first storage medium. And when the controller determines that the access frequency of the data is lower than the first access frequency threshold, it can no longer store the data as hot data in the first storage medium, but can move it to other storage media for storage. For example, when the access frequency of the data is lower than the second access frequency threshold, the data can be stored as cold data in the second storage medium, or when the access frequency of the data is lower than the first access frequency threshold and greater than the second access frequency threshold, the data can be stored as warm data in the tenth storage medium.
[0122] Among them, when moving data from the first storage medium to other storage media, it can be achieved by modifying the correspondence between the logical page and the physical page of the data. Specifically, when an external device accesses the flash memory, it can be achieved through the logical block address (LBA), and each LBA represents a logical page. Inside the flash memory, the controller reads and writes data based on the flash page as the basic unit, and the flash page is usually also called the Physical Page. When an external device writes data into the flash memory, the controller will find an available physical page in the flash memory, store the data based on this physical page, and record the mapping relationship between the logical page related to the data and this physical page. Usually, a mapping table that records the correspondence between the logical page and the physical page is maintained inside the controller. When the data is subsequently moved to other storage media, the controller can modify the mapping relationship between the original logical page and physical page of the data to the mapping relationship between the logical page and the new physical page where the data is newly written currently, that is, perform redirection.
[0123] Similarly, for the data stored in the second storage medium, the controller can also monitor the frequency (or frequency of access) of the data being accessed, and determine whether it continues to be stored as cold data in the second storage medium based on the frequency (or frequency of access) of the data being accessed. And in the case of not being cold data, further determine whether to move the data to the first storage medium for storage or to the second storage medium for storage. Similarly, for each data stored in the tenth storage medium, it can also be determined whether to move and to which storage medium to move for storage based on the frequency or frequency of access of the data.
[0124] Of course, in practical applications, the controller can also determine in which storage medium a part of the data stored in the flash memory is located according to the user's configuration operation. For example, for the data A pre-stored in the second storage medium, based on the user's configuration for the data A, the controller can store the data A in the first storage medium or the tenth storage medium. This embodiment does not limit the regulation of the storage location of the data in the flash memory.
[0125] In addition, the embodiment of the present application also provides a storage medium conversion method, which can be applied to the controller in the above-mentioned flash memory. The flash memory can include a controller, a first storage medium, and a second storage medium. Of course, the flash memory can also include other more storage media. In this embodiment, the flash memory including the first storage medium and the second storage medium is taken as an example for illustrative purposes. The method can include:
[0126] S701: The controller converts some or all of the first storage media, where the first storage media is used to store hot data.
[0127] S702: The controller converts some or all of the second storage media, where the second storage media is used to store cold data, and the number of bits stored in each storage unit in the first storage media is less than the number of bits stored in each storage unit in the second storage media.
[0128] It should be noted that in this embodiment, the order of the controller performing the conversion of the first storage media and the conversion of the second storage media is not limited. For example, the controller may first perform the conversion of the first storage media and then perform the conversion of the second storage media; or, it may first perform the conversion of the second storage media and then perform the conversion of the first storage media; or, it may perform the conversion of the first storage media and the second storage media simultaneously, etc.
[0129] Exemplarily, the first storage media can be any one of SLC, MLC, TLC or QLC, and the second storage media can be any one of MLC, TLC, QLC or PLC. Specifically, when the first storage media is SLC, the second storage media can be MLC, TLC, QLC or PLC; when the first storage media is SLC or MLC, the second storage media can be TLC, QLC or PLC; when the first storage media is SLC, MLC or TLC, the second storage media can be QLC or PLC; when the first storage media is SLC, MLC, TLC or QLC, the second storage media can be PLC. Of course, the above examples are only for some illustrative purposes and are not used to limit the specific forms of the first storage media and the second storage media in practical applications to be limited to the above examples. It can also be other possible storage media, etc., and this embodiment does not limit this.
[0130] Among them, the hot data stored in the first storage media refers to the data that is frequently accessed. Correspondingly, the cold data stored in the second storage media can refer to the data that is not frequently accessed. Exemplarily, the controller can monitor the frequency (or frequency) of data access in the flash memory, and when the frequency exceeds the first frequency threshold, determine that the data is hot data and store it in the first storage media. When the frequency is lower than the second frequency threshold, determine that the data is cold data and store it in the second storage media. Further, the flash memory may also include a tenth storage media, such as Figure 6As shown; and when the frequency of accessing data in the flash memory exceeds the second frequency threshold but is lower than the first frequency threshold, it can be determined that the data is warm data and stored in the tenth storage medium. Additionally, when there are other storage media in the flash memory, the storage media for storing hot data, in addition to including the first storage medium, can also include other storage media, that is, multiple storage media can be used to store hot data. Similarly, in the flash memory, multiple storage media can also be used to store cold data or warm data, etc.
[0131] Of course, in other exemplary embodiments, the controller can also store the data as hot data in the first storage medium when it determines that the data has a hot attribute identifier, store the data as cold data in the second storage medium when it determines that the data has a cold attribute identifier, and store the data as warm data in the tenth storage medium when it determines that the data has a warm attribute identifier.
[0132] Alternatively, the controller can also determine based on the file type to which the data belongs. For example, when the file type to which the data belongs is a text file, it can be stored as hot data in the first storage medium; when the file type to which the data belongs is an audio / video file, it can be stored as cold data in the second storage medium; when the file type to which the data belongs is a picture file, it can be stored as warm data in the tenth storage medium. Specifically, taking the first storage medium as an example, the controller can determine the file type of the target data and, by looking up the correspondence between the file type and the storage medium, determine that the file type of the target data corresponds to the first storage medium, so that the controller can store the target data in the first storage medium. Of course, if the controller determines that the file type of the target data corresponds to the second storage medium, the target data can be stored in the second storage medium. Exemplarily, the controller can automatically identify the file type of the target data. For example, the controller can read the superblock of the file system to which the target data belongs, thereby obtaining the attribute information of the file system saved in the superblock. This attribute information can include, for example, the category of the file system, the encoding format of the file, etc. Then, the controller can further determine the file type of the target data based on this attribute information of the file system. In this way, the controller can automatically identify the file type of the target data without the intervention of the upper-layer user. Optionally, it can also be that the user performs relevant configuration operations to inform the controller of the file type to which the target data belongs. This embodiment does not limit the specific implementation manner for the controller to determine the file type of the target data.
[0133] As an example, the correspondence between the file type and the storage medium can be configured by the user. Specifically, taking the configuration of the first storage medium as an example, the controller can respond to the user configuration operation for the first storage medium and establish the correspondence between the first storage medium and the file type. In this way, when the data written to the flash memory belongs to the file type corresponding to the first storage medium, the data can be written into the first storage medium. Similarly, the controller can also establish the correspondence between the second storage medium and the file type of the cold data, and the correspondence between the tenth storage medium and the file type of the warm data based on the user's configuration operation. Of course, in other possible implementation manners, the controller can also determine the first file type corresponding to the data frequently accessed according to the user's access habit to the data in the flash memory, so as to establish the correspondence between the first storage medium and the first file type; at the same time, determine the second file type corresponding to the data not frequently accessed and establish the correspondence between the second file type and the second storage medium. Similarly, the correspondence between the tenth storage medium and the file type corresponding to the warm data can also be established in this way.
[0134] In this embodiment, the specific implementation manner for determining whether the data is cold data, hot data or warm data is not limited.
[0135] At the same time, in this embodiment, the controller can also control the conversion of the first storage medium and / or the second storage medium. As some examples of converting the storage medium, the controller can specifically convert the first storage medium and / or the second storage medium in the following scenarios.
[0136] Scenario 1: The storage space of the flash memory is insufficient.
[0137] As Figure 8 shown, the controller can determine whether the remaining storage space of the flash memory is lower than a preset first space threshold, or determine whether the storage space utilization rate of the flash memory is greater than the first utilization rate threshold. When the controller determines that the remaining storage space is lower than the first space threshold, or the storage space utilization rate exceeds the first utilization rate threshold, the controller can convert part or all of the first storage medium into a third storage medium to increase the storage space of the flash memory. Among them, the number of bits stored in each storage unit of the third storage medium is greater than the number of bits stored in each storage unit of the first storage medium. The third storage medium can be the second storage medium described above, or a storage medium different from the second storage medium.
[0138] Alternatively, when the controller determines that the remaining storage space is lower than the first space threshold or the storage space utilization rate exceeds the first utilization rate threshold, the controller may convert some or all of the second storage medium into a fourth storage medium to increase the storage space of the flash memory. Herein, the number of bits that each storage cell in the fourth storage medium can store is greater than the number of bits that each storage cell in the second storage medium can store.
[0139] Further, when converting the storage medium, it is usually necessary to erase the data currently stored in the converted part of the storage medium. Therefore, to avoid loss of the data stored in the converted part of the storage medium, as Figure 8 shown, the data stored in this part of the storage medium can be migrated. Specifically, before converting the storage medium, the part to be converted in the storage medium can be determined, and the data stored in the part to be converted can be migrated to the unconverted part in the storage medium for storage. In this way, it is possible to avoid, as much as possible, loss of some of the data stored in the storage medium during the conversion of the storage medium. When converting the first storage medium, the data stored in the part to be converted in the first storage medium can be migrated to the unconverted part in the first storage medium, and when converting the second storage medium, the data stored in the part to be converted in the second storage medium can be migrated to the unconverted part in the second storage medium.
[0140] Scenario 2: The data processing performance of the flash memory needs to be improved.
[0141] As Figure 9 shown, the controller may determine whether the remaining storage space of the flash memory exceeds the first space threshold, or determine whether the storage space utilization rate of the flash memory is lower than the first utilization rate threshold, or determine whether the error rate of the flash memory exceeds the error rate threshold, or determine whether the access speed of the flash memory is lower than the access speed threshold. When the controller determines that the remaining storage space does not exceed the first space threshold, or the storage space utilization rate is not lower than the first utilization rate threshold, or the error rate exceeds the error rate threshold, or the access speed is lower than the access speed threshold, the controller converts some or all of the first storage medium into a fifth storage medium, and the number of bits that each storage cell in the fifth storage medium can store is less than the number of bits that each storage cell in the first storage medium can store, that is, the data processing performance of the fifth storage medium is higher than that of the first storage medium.
[0142] Alternatively, when the controller determines that the remaining storage space does not exceed the first space threshold, or the storage space utilization rate is not lower than the first utilization rate threshold, or the error rate exceeds the error rate threshold, or the access speed is lower than the access speed threshold, the controller may convert some or all of the second storage medium into a sixth storage medium, where the number of bits that each storage unit in the sixth storage medium can store is less than the number of bits that each storage unit in the second storage medium can store, that is, the data processing performance of the sixth storage medium is higher than that of the second storage medium. Among them, the sixth storage medium may be the first storage medium or other storage media different from the first storage medium.
[0143] Furthermore, to avoid data loss in the storage medium of the converted part, as Figure 9 shown, before converting the storage medium, the data stored in the storage medium of the part to be converted can be migrated to the unconverted part. The specific implementation method is similar to the data migration method Figure 8 shown above, and specific details can be referred to the relevant descriptions above, which will not be elaborated here.
[0144] Scenario 3: Insufficient storage space for storing hot data.
[0145] As Figure 10 shown, the controller can determine whether the remaining storage space of the first storage medium is lower than the second space threshold, or determine whether the storage space utilization rate of the first storage medium exceeds the second utilization rate threshold. When the controller determines that the remaining storage space of the first storage medium is lower than the second space threshold or the storage space utilization rate exceeds the second utilization rate threshold, the controller may convert some or all of the second storage medium into the first storage medium, thereby increasing the storage space for hot data.
[0146] Alternatively, when the controller determines that the remaining storage space of the first storage medium is lower than the second space threshold or the storage space utilization rate exceeds the second utilization rate threshold, the controller may convert some or all of the first storage medium into a seventh storage medium, where the number of bits that each storage unit in the seventh storage medium can store is greater than the number of bits that each storage unit in the first storage medium can store and less than the number of bits that each storage unit in the second storage medium can store, and the converted seventh storage medium can be used to store hot data.
[0147] Alternatively, when the controller determines that the remaining storage space of the first storage medium is lower than the second space threshold or the storage space utilization rate exceeds the second utilization rate threshold, the controller may convert some or all of the second storage medium into the seventh storage medium.
[0148] Furthermore, to avoid data loss in the storage medium of the converted part, asFigure 10 As shown, before converting the storage medium, the data stored in the storage medium of the part to be converted can be migrated to the unconverted part. The specific implementation method is similar to the Figure 8 data migration method shown above. For details, please refer to the relevant description above and will not be elaborated here.
[0149] Scenario 4: Insufficient storage space for storing cold data.
[0150] As Figure 11 shown, the controller can determine whether the remaining storage space of the second storage medium is lower than the third space threshold, or determine whether the storage space utilization rate of the second storage medium exceeds the third utilization rate threshold. When the controller determines that the remaining storage space of the second storage medium is lower than the third space threshold or the storage space utilization rate exceeds the third utilization rate threshold, the controller can convert part or all of the first storage medium into an eighth storage medium, and the number of bits stored in each storage unit in the eighth storage medium is greater than the number of bits stored in each storage unit in the first storage medium. Moreover, the eighth storage medium is used to store cold data, thereby increasing the storage space for cold data.
[0151] Alternatively, when the controller determines that the remaining storage space of the second storage medium is lower than the third space threshold or the storage space utilization rate exceeds the third utilization rate threshold, the controller can convert part or all of the second storage medium into a ninth storage medium, and the number of bits stored in each storage unit in the ninth storage medium is greater than the number of bits stored in each storage unit in the second storage medium. Moreover, the ninth storage medium is used to store cold data.
[0152] Furthermore, to avoid data loss in the storage medium of the converted part, as Figure 11 shown, before converting the storage medium, the data stored in the storage medium of the part to be converted can be migrated to the unconverted part. The specific implementation method is similar to the Figure 8 data migration method shown above. For details, please refer to the relevant description above and will not be elaborated here.
[0153] Scenario 5: An external conversion instruction indicates to convert the storage medium.
[0154] In this scenario, the controller can receive a conversion instruction, which can be issued by a user through an external device connected to the flash memory, for example. The controller can receive and respond to the conversion instruction, and convert some / all of the first storage medium into the second storage medium, or convert some / all of the second storage medium into the first storage medium, etc. In other possible embodiments, the conversion instruction may further include the identifier of the storage medium to be converted and the identifier of the target storage medium to be converted into. In this way, the controller can determine whether to convert the first storage medium or the second storage medium according to the identifier of the storage medium to be converted in the conversion instruction, and determine the target storage medium into which the first storage medium or the second storage medium is to be converted according to the identifier of the target storage medium in the conversion instruction.
[0155] Further, before converting the storage medium, the data stored in the storage medium of the part to be converted can be migrated to the part that is not converted.
[0156] In practical applications, the access frequency of the hot data stored in the first storage medium and the cold data stored in the second storage medium may change. Therefore, in a further possible embodiment, the controller can also monitor the access frequency (or frequency) of each data in the first storage medium, and when the controller determines that the access frequency of the data is lower than the first access frequency threshold, it can no longer store the data as hot data in the first storage medium, but can move it to other storage media for storage. Similarly, for the second storage medium, the controller can determine whether to migrate it to other storage media for storage according to the access frequency or frequency of each data in the second storage medium.
[0157] Of course, in practical applications, the controller can also determine or adjust which storage medium some data stored in the flash memory is stored in according to the user's configuration operation. For example, the user can specify to store certain data in the first storage medium or the second storage medium.
[0158] With the same inventive concept as the above method, an embodiment of the present application further provides a solid-state drive using the aforementioned flash memory. As Figure 12 shown, the solid-state drive 1200 may include a processor 1210. The solid-state drive 1200 may further include a memory 1220. Among them, the processor 1210 may be the controller in the aforementioned flash memory, and the processor 1210 and the memory 1220 may be connected by a connection line or other means. The memory 1220 is used to store instructions. The processor 1210 is used to execute the instructions stored in the memory 1220 and implement Figure 7Any method executed by the controller described in Figure 7 The method executed by the controller described in. For the sake of brevity, it will not be elaborated here.
[0159] Figure 13 FIG. is a schematic structural diagram of a computing device 1300 for storage medium conversion according to an embodiment of the present application.
[0160] As Figure 13 shown, the computing device 1300 includes a processor 1301, and the processor 1301 is connected to a memory 1305. The processor 1301 may be a field programmable gate array (full English name: Field Programmable Gate Array, abbreviation: FPGA), or a digital signal processor (full English name: Digital Signal Processor, abbreviation: DSP), etc., computing logic or a combination of any of the above computing logics. The processor 1301 may also be a single-core processor or a multi-core processor.
[0161] The memory 1305 may be a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ReadOnly Memory, EPROM), an electrically erasable programmable read-only memory (Electrically ErasableProgrammable read only memory, EEPROM), a register, or any other form of storage medium well known in the art. In particular, the memory 1305 may be the flash memory in the foregoing embodiments. Among them, the memory 1305 may be used to store program instructions, and when the program instructions are executed by the processor 1301, the processor 1301 executes the method described in the foregoing embodiments.
[0162] The connection line 1309 is used to transmit information between the components of the communication device. The connection line 1309 may use a wired connection method or a wireless connection method, and the present application does not limit this. The connection line 1309 is also connected to a network interface 1304. The network interface 1304 may be used to connect to other computing devices or an auxiliary memory 1302.
[0163] The network interface 1304 uses a connection device such as, but not limited to, a cable or a twisted pair to implement communication with other devices or a network 1311. The network interface 1304 may also be interconnected with the network 1311 in a wireless form.
[0164] Some features of the embodiments of the present application can be completed / supported by the processor 1301 executing program instructions or software code in the memory 1305. The software components loaded on the memory 1305 can be generally summarized functionally or logically.
[0165] In addition, Figure 13 merely an example of a computing device 1300, and the computing device 1300 may include more or fewer components than Figure 13 shown, or have different component configurations. At the same time, Figure 13 the various components shown in can be implemented in hardware, software, or a combination of hardware and software. For example, the memory and the processor can be implemented in one module, and the instructions in the memory can be pre-written into the memory or loaded by the subsequent processor during execution.
[0166] The processor may cooperate with the memory. The memory can be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., or a volatile memory, such as a random-access memory (RAM). The memory is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0167] In the embodiments of the present application, the specific connection medium between the above communication interface, processor, and memory is not limited. For example, the memory, processor, and communication interface can be connected through a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0168] Based on the above embodiments, the embodiments of the present application further provide a computer storage medium, in which a software program is stored, and when the software program is read and executed by one or more processors, the methods performed by the cloud center or the first edge device provided in any one or more of the above embodiments can be implemented. The computer storage medium may include: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory, a random-access memory, a magnetic disk, or an optical disc.
[0169] Based on the above embodiments, the embodiments of the present application further provide a chip, which includes a processor for implementing the functions of the cloud center or the first edge device involved in any one or more of the above embodiments, for example, for implementing Figures 6 - 7 the method performed by the first edge device in, or for implementing Figures 6 - 7The method executed by the Zhongyun Center. Optionally, the chip further includes a memory for storing the necessary program instructions and data for the processor to execute. The chip can be composed of a chip or include a chip and other discrete devices.
[0170] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0171] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices, and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0172] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0173] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0174] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the scope of the embodiments of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these changes and modifications.
Claims
1. A flash memory, characterized in that, The flash memory includes a controller, a first storage medium, and a second storage medium. The first storage medium is used to store hot data, and the second storage medium is used to store cold data. The number of bits stored in each storage unit in the first storage medium is less than the number of bits stored in each storage unit in the second storage medium; The controller is used to convert part or all of the first storage medium; The controller is further used to determine, according to the user's usage habits, a first file type of data with a higher access frequency or frequency and a second file type of data with a lower access frequency or frequency, and establish a correspondence between the first file type and the first storage medium, and a correspondence between the second file type and the second storage medium, and write the data of the first file type into the first storage medium, and write the data of the second file type into the second storage medium.
2. The flash memory according to claim 1, wherein The controller is further used to convert part or all of the second storage medium; 3. The flash memory according to claim 2, characterized in that, The controller is used to perform at least one of the following operations when the remaining storage space of the flash memory is lower than a first space threshold or the storage space utilization rate of the flash memory exceeds a first utilization rate threshold: Convert part or all of the first storage medium into a third storage medium, where the number of bits stored in each storage unit in the third storage medium is greater than the number of bits stored in each storage unit in the first storage medium; Or, convert part or all of the second storage medium into a fourth storage medium, where the number of bits stored in each storage unit in the fourth storage medium is greater than the number of bits stored in each storage unit in the second storage medium.
4. The flash memory according to claim 2, wherein The controller is used to perform at least one of the following operations when the remaining storage space of the flash memory exceeds a first space threshold, or the storage space utilization rate of the flash memory is lower than a first utilization rate threshold, or the error rate of the flash memory exceeds an error rate threshold, or the access speed of the flash memory is lower than an access speed threshold: Convert part or all of the first storage medium into a fifth storage medium, where the number of bits stored in each storage unit in the fifth storage medium is less than the number of bits stored in each storage unit in the first storage medium; Or, convert part or all of the second storage medium into a sixth storage medium, where the number of bits stored in each storage unit in the sixth storage medium is less than the number of bits stored in each storage unit in the second storage medium.
5. The flash memory according to claim 2, wherein, The controller is used to perform at least one of the following operations when the remaining storage space of the first storage medium is lower than a second space threshold or the storage space utilization rate of the first storage medium exceeds a second utilization rate threshold: Convert part or all of the second storage medium into the first storage medium; Alternatively, convert part or all of the first storage medium into a seventh storage medium, where the number of bits stored in each storage unit in the seventh storage medium is greater than the number of bits stored in each storage unit in the first storage medium and less than the number of bits stored in each storage unit in the second storage medium, and the seventh storage medium is used to store the hot data; Alternatively, convert part or all of the second storage medium into the seventh storage medium.
6. The flash memory according to claim 2, characterized in that, The controller is configured to perform at least one of the following operations when the remaining storage space of the second storage medium is lower than a third space threshold or the storage space utilization rate of the second storage medium exceeds a third utilization rate threshold: Alternatively, convert part or all of the first storage medium into an eighth storage medium, where the number of bits stored in each storage unit in the eighth storage medium is greater than the number of bits stored in each storage unit in the first storage medium, and the eighth storage medium is used to store the cold data; Alternatively, convert part or all of the second storage medium into a ninth storage medium, where the number of bits stored in each storage unit in the ninth storage medium is greater than the number of bits stored in each storage unit in the second storage medium, and the ninth storage medium is used to store the cold data.
7. The flash memory according to claim 1, wherein The hot data includes data with an access frequency exceeding a first frequency threshold or data carrying a hot attribute identifier, and the cold data includes data with an access frequency lower than a second frequency threshold or data carrying a cold attribute identifier.
8. The flash memory according to claim 1, characterized in that The flash memory further includes a tenth storage medium for storing warm data, where the number of bits stored in each storage unit in the tenth storage medium is greater than the number of bits stored in each storage unit in the first storage medium and less than the number of bits stored in each storage unit in the second storage medium, and the warm data includes data with an access frequency lower than the first frequency threshold and higher than the second frequency threshold or data carrying a warm attribute identifier.
9. The flash memory according to claim 2, wherein The controller is configured to: Receive a conversion instruction for instructing a storage medium conversion of the flash memory; In response to the conversion instruction, convert part or all of the first storage medium into the second storage medium, or convert part or all of the second storage medium into the first storage medium.
10. The flash memory according to claim 1, characterized in that, The first storage medium is a single-level cell (SLC), and the second storage medium is a multi-level cell (MLC) with two levels, a triple-level cell (TLC), a quadruple-level cell (QLC), or a five-level cell (PLC); Alternatively, the first storage medium is the SLC or the MLC, and the second storage medium is the TLC, the QLC, or the PLC; Alternatively, the first storage medium is the SLC, the MLC, or the TLC, and the second storage medium is the QLC or the PLC; Alternatively, the first storage medium is the SLC, the MLC, the TLC, or the QLC, and the second storage medium is the PLC.
11. The flash memory according to any one of claims 1 to 10, characterized in that, The controller is further configured to: Determine the file type of the target data to be written to the flash memory; According to the correspondence between the file type and the first storage medium, write the target data into the first storage medium.
12. The flash memory according to claim 11, wherein, The controller is used for: Read the superblock of the file system to which the target data belongs to obtain the attribute information in the file system; Determine the file type of the target data according to the attribute information in the file system.
13. The flash memory according to claim 11, characterized in that, The controller is further used for: Respond to the user configuration operation for the first storage medium, and establish the correspondence between the first storage medium and the file type.
14. A storage medium conversion method, characterized in that, The method is applied to a controller in a flash memory. The flash memory includes the controller, a first storage medium, and a second storage medium. The first storage medium is used to store hot data, the second storage medium is used to store cold data, and the number of bits stored in each storage unit in the first storage medium is less than the number of bits stored in each storage unit in the second storage medium; The method includes: converting part or all of the first storage medium; or Converting part or all of the second storage medium; The method further includes: according to the user's usage habit, determine the first file type of the data with a higher access frequency or frequency, the second file type of the data with a lower access frequency or frequency, and establish the correspondence between the first file type and the first storage medium, and the correspondence between the second file type and the second storage medium, and write the data of the first file type into the first storage medium, and write the data of the second file type into the second storage medium.
15. The method according to claim 14, wherein The conversion of part or all of the second storage medium includes: When the remaining storage space of the first storage medium is lower than the second space threshold or the storage space utilization rate of the first storage medium exceeds the second utilization rate threshold, convert part or all of the first storage medium into a seventh storage medium. The number of bits stored in each storage unit in the seventh storage medium is greater than the number of bits stored in each storage unit in the first storage medium and less than the number of bits stored in each storage unit in the second storage medium. The seventh storage medium is used to store the hot data; The conversion of part or all of the second storage medium includes: When the remaining storage space of the first storage medium is lower than the second space threshold or the storage space utilization rate of the first storage medium exceeds the second utilization rate threshold, convert part or all of the second storage medium into the first storage medium, or convert part or all of the second storage medium into the seventh storage medium.
16. The method according to claim 14, wherein The conversion of part or all of the second storage medium includes: When the remaining storage space of the second storage medium is lower than a third space threshold or the storage space utilization rate of the second storage medium exceeds a third utilization rate threshold, part or all of the second storage medium is converted into an eighth storage medium, where the number of bits stored in each storage unit in the eighth storage medium is greater than the number of bits stored in each storage unit in the second storage medium, and the eighth storage medium is used to store the cold data; The converting of part or all of the first storage medium includes: When the remaining storage space of the second storage medium is lower than a third space threshold or the storage space utilization rate of the second storage medium exceeds a third utilization rate threshold, part or all of the first storage medium is converted into the second storage medium, or part or all of the first storage medium is converted into the eighth storage medium.
17. The method according to any one of claims 14 to 16, characterized in that The converting of part or all of the first storage medium includes: Receiving a conversion instruction for instructing to perform a storage medium conversion on the flash memory; Responding to the conversion instruction, and converting part or all of the first storage medium into the second storage medium; The converting of part or all of the second storage medium includes: Receiving a conversion instruction for instructing to perform a storage medium conversion on the flash memory; Responding to the conversion instruction, and converting part or all of the second storage medium into the first storage medium.
18. A computing device, characterized in that, The device includes a memory and a processor. The memory is used to store software instructions. The processor calls the software instructions stored in the memory to execute the method according to any one of claims 14 to 17 above.
Citation Information
Patent Citations
Method for managing storage regions and solid state drive
CN106843762A