Flash memory block management method, device, apparatus and storage medium

By constructing a mapping relationship between virtual multi-layer storage units and single-layer storage units in the solid-state drive (SSD), the problem of insufficient capacity when multi-layer storage units are converted into single-layer storage units is solved, achieving efficient data writing of single-layer storage units and improving the write performance of the SSD.

CN115657948BActive Publication Date: 2026-07-10SHENZHEN CITY TECHWIN SEMICONDUCTOR COMPANY LIMITED

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN CITY TECHWIN SEMICONDUCTOR COMPANY LIMITED
Filing Date
2022-10-25
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In existing technologies, when solid-state drives (SSDs) convert multi-layer storage units into single-layer storage units, the capacity of a single-layer storage unit can only reach 1/(N+1) of the capacity of the multi-layer storage unit, resulting in low data writing efficiency and failing to effectively improve the write performance of SSDs.

Method used

In the flash memory storage area, multi-level storage cells are converted into single-level storage cells, and a mapping relationship is established between virtual multi-level storage cells and single-level storage areas. Through the association between virtual multi-level storage cells, single-level storage cells, and multi-level storage cells, data migration and management are realized, ensuring that the capacity of single-level storage cells reaches 1/N of the capacity of multi-level storage cells.

Benefits of technology

It improves the capacity and data writing efficiency of a single-level storage unit, extends the duration of writing performance of a single-level storage unit, and enhances the initial state writing performance of the solid-state drive.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115657948B_ABST
    Figure CN115657948B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of flash memory, and discloses a flash memory block management method, device, equipment and storage medium, the method comprising the following steps: converting a first predetermined number of multilayer storage units into single-layer storage units in a storage area of a flash memory; the storage area comprises a plurality of multilayer storage units; a virtual multilayer storage unit is constructed, and a mapping relationship between the virtual multilayer storage unit and a single-layer storage area is established; the single-layer storage area comprises at least one single-layer storage unit; and data is written into the single-layer storage unit in the single-layer storage area. In the application, when the multilayer storage unit is converted into the single-layer storage unit, the virtual multilayer storage unit is respectively associated with the single-layer storage unit and the multilayer storage unit, so that the single-layer storage unit does not need to be associated with the multilayer storage unit, the capacity of the single-layer storage unit can reach 1 / N of the capacity of the multilayer storage unit at most, and the data writing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of flash memory technology, and in particular to a flash memory block management method, apparatus, device, and storage medium. Background Technology

[0002] Solid-state drives (SSDs), often shortened to SSDs, are increasingly widely used in daily life due to their superior performance. The mainstream SSDs currently use NAND flash memory as their storage medium. NAND flash data is stored in memory cells in bits. Based on the number of bits stored in each memory cell, memory cells can be categorized as single-level cells (SLC), multi-level cells (MLC), quad-level cells (QLC), and multi-level cells (XLC). The read / write speed of a memory cell is inversely related to its capacity; therefore, SLC has the smallest capacity but the fastest read / write speed and the highest reliability.

[0003] To improve the write performance of solid-state drives (SSDs), a portion of an XLC storage cell (such as MLC, TLC, QLC, etc.) is partitioned and converted into a single-level storage cell (used as a dynamic SLC cache). When writing data to an SSD, the data is first written to the single-level storage cell, and then the data in the single-level storage cell is subsequently moved to the multi-level storage cell.

[0004] When converting multi-layer storage units into single-layer storage units, the maximum capacity of a single-layer storage unit can only reach 1 / (N+1) of the capacity of the multi-layer storage unit, which is less than 1 / N, resulting in low data write efficiency. Therefore, how to improve the conversion capacity of single-layer storage units to enhance the initial state write performance duration of solid-state drives is an urgent problem to be solved. Summary of the Invention

[0005] In view of this, in order to solve the problems of the prior art, this application provides a flash memory block management method, apparatus, device and storage medium.

[0006] In a first aspect, this application provides a flash memory block management method, including:

[0007] In the storage area of ​​flash memory, a first predetermined number of multi-layer storage cells are converted into single-layer storage cells; the storage area contains multiple multi-layer storage cells;

[0008] Construct a virtual multi-layer storage unit and establish a mapping relationship between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage area contains at least one of the single-layer storage units;

[0009] Data is written to the single-level storage cell in the single-level storage area.

[0010] In an optional implementation, it further includes:

[0011] If the amount of data written to the flash memory is not greater than a predetermined capacity threshold, then all multi-layer storage cells of the flash memory are converted into single-layer storage cells, and data is written to the single-layer storage cells.

[0012] In an optional implementation, it further includes:

[0013] If the total data write volume of all single-level storage units after conversion is greater than the predetermined capacity threshold, then the second predetermined number of single-level storage units will be converted into multi-level storage units accordingly, and a mapping relationship between the virtual multi-level storage units and the multi-level storage units will be established.

[0014] Based on the mapping relationship between the single-layer storage area, the virtual multi-layer storage unit, and the multi-layer storage unit, the data in the single-layer storage area that is full of data is migrated to the multi-layer storage unit, and the mapping relationship between the single-layer storage area and the virtual multi-layer storage unit is canceled.

[0015] In an optional implementation, it further includes:

[0016] If the amount of data written to the flash memory exceeds a predetermined capacity threshold, a mapping relationship is established between the virtual multi-layer storage unit and the multi-layer storage unit; one virtual multi-layer storage unit corresponds to one multi-layer storage unit.

[0017] Based on the mapping relationship between the single-layer storage area, the virtual multi-layer storage unit, and the multi-layer storage unit, the data in the single-layer storage area is migrated to the multi-layer storage unit, and the mapping relationship between the single-layer storage area and the virtual multi-layer storage unit is canceled.

[0018] In an optional implementation, it further includes:

[0019] Upon receiving a data read instruction, the corresponding virtual multi-level storage unit is located according to the data read instruction, and it is determined whether the virtual multi-level storage unit has a mapping relationship with the single-level storage area.

[0020] If so, data is read from the single-layer storage area mapped to the virtual multi-layer storage unit;

[0021] If not, data is read from the multi-level storage unit mapped to the virtual multi-level storage unit.

[0022] In an optional implementation, migrating data from the single-level storage area to the multi-level storage unit based on the mapping relationship between the single-level storage area, the virtual multi-level storage unit, and the multi-level storage unit includes:

[0023] Determine whether the single-layer storage area mapped to the virtual multi-layer storage unit is full of data;

[0024] If so, the data in the single-layer storage area will be migrated to the multi-layer storage unit mapped to the corresponding virtual multi-layer storage unit;

[0025] If not, search for other virtual multi-level storage units until the single-level storage area mapped to the other virtual multi-level storage units is full of data, then migrate the corresponding single-level storage area to the multi-level storage unit mapped to the other virtual multi-level storage units.

[0026] In an optional implementation, the storage area is any one of a two-layer storage area, a three-layer storage area, or a four-layer storage area.

[0027] Secondly, this application provides a flash memory block management device, comprising:

[0028] A conversion module is used to convert a first predetermined number of multi-layer storage cells into single-layer storage cells in the storage area of ​​flash memory; the storage area contains multiple multi-layer storage cells;

[0029] A construction module is used to construct a virtual multi-layer storage unit and establish a mapping relationship between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage area contains at least one of the single-layer storage units.

[0030] The write module is used to write data to the single-level storage unit in the single-level storage area.

[0031] Thirdly, this application provides a computer device, the computer device including a memory and at least one processor, the memory storing a computer program, and the processor executing the computer program to implement the aforementioned flash memory block management method.

[0032] Fourthly, this application provides a computer storage medium storing a computer program, which, when executed, implements the aforementioned flash memory block management method.

[0033] The embodiments of this application have the following beneficial effects:

[0034] This application provides a flash memory block management method. The method includes converting a first predetermined number of multi-level storage cells into single-level storage cells within a flash memory storage area; the storage area includes multiple multi-level storage cells; constructing a virtual multi-level storage cell and establishing a mapping relationship between the virtual multi-level storage cell and the single-level storage area; the single-level storage area includes at least one single-level storage cell; and writing data to the single-level storage cell in the single-level storage area. In this application, when converting multi-level storage cells into single-level storage cells, a virtual multi-level storage cell is constructed, and this virtual multi-level storage cell is associated with both the single-level storage cell and the multi-level storage cell, thus eliminating the need to associate the single-level storage cell with the multi-level storage cell. This allows the capacity of a single-level storage cell to reach a maximum of 1 / N of the multi-level storage cell capacity, thereby extending the duration of single-level storage cell write performance and improving data write efficiency. Attached Figure Description

[0035] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and should not be considered as a limitation on the scope of protection of this application. In the various drawings, similar components are numbered similarly.

[0036] Figure 1 A schematic diagram of the first embodiment of the flash memory block management method in this application is shown;

[0037] Figure 2 A schematic diagram of a second embodiment of the flash memory block management method in this application is shown;

[0038] Figure 3 A schematic diagram of a third embodiment of the flash memory block management method in this application is shown;

[0039] Figure 4 A schematic diagram of a fourth embodiment of the flash memory block management method in this application is shown;

[0040] Figure 5 A schematic diagram of the fifth embodiment of the flash memory block management method in this application is shown;

[0041] Figure 6 A schematic diagram of the structure of the flash memory block management device in an embodiment of this application is shown. Detailed Implementation

[0042] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0043] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0044] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.

[0045] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0046] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.

[0047] In solid-state drive (SSD) storage modes, single-level storage means one storage unit stores 1 bit of data, while multi-level storage means one storage unit stores n bits of data, where n = 2, 3, 4, ..., n. The choice of storage medium depends on the workload to provide matching data input and output performance. The read / write patterns for data blocks differ between multi-level and single-level storage. In single-level storage, data is directly read from and written to a single storage medium. In multi-level storage, data is preferentially written to the top-level storage medium by default, and data needs to be moved to the top-level medium before reading. Specifically: when writing data, new data blocks are written to the top-level storage medium by default; if the top-level storage medium is full, the server will store the data sequentially in the next lower-level storage medium; if all storage media are full, the server will evict expired data according to the user-specified cache eviction policy; if expired data cannot be evicted and all available storage space is full, no data can be written. When reading data, in a multi-tiered storage model, cold data is transparently dumped to a lower-tier storage medium, while reading data involves heating the data and placing it in the top-tier storage.

[0048] Furthermore, to improve the write performance of solid-state drives (SSDs), a portion of the XLC storage cells (such as MLC, TLC, QLC, etc.) is converted into single-layer storage cells (used as dynamic SLC cache). When writing data to the SSD, the data is first written to a single-layer storage cell (SLC Block), and then the data in the single-layer storage cell is subsequently moved to multiple layers of storage cells.

[0049] When writing data, a single-level storage unit is first requested, and simultaneously, an actual multi-level storage unit is requested, binding the single-level and multi-level storage units together. Therefore, the maximum capacity converted to a single-level storage unit can only reach 1 / (N+1) of the capacity of an XLC block. Specifically, when the flash memory storage unit is MLC, N=2; when the flash memory storage unit is TLC, N=3; and when the flash memory storage unit is QLC, N=4.

[0050] Specifically, taking TLC blocks as an example, assuming the solid-state drive capacity is 60G, the 45G TLC space of TLC Block1, TLC Block2, and TLC Block3 can only be converted into 15G SLC Block space. When writing data, if 15G SLC Block space is requested, then 15G TLC Block4 space needs to be requested and bound to the SLC Block space at the same time. Therefore, after conversion, the maximum capacity of a single-layer storage unit can only reach 1 / (N+1) of the capacity of a multi-layer storage unit.

[0051] Based on this, this embodiment provides a flash memory block management method to improve the conversion quality of multi-layer storage units to single-layer storage units, so that the maximum capacity of the converted single-layer storage unit can reach 1 / N of the capacity of the multi-layer storage unit, thereby improving the efficiency of data writing and extending the duration of the initial state write performance of the solid-state drive.

[0052] Example 1

[0053] Please refer to Figure 1 This application provides a flash memory block management method, which will be described in detail below.

[0054] S10, converting a first predetermined number of multi-layer storage cells into single-layer storage cells in the storage area of ​​the flash memory; the storage area contains multiple multi-layer storage cells.

[0055] Before writing data to the solid-state drive (SSD), a first predetermined number of multi-level storage cells (XLC blocks) in the flash memory storage area of ​​the SSD are converted into single-level storage cells (SLC blocks) one by one. The storage area is a multi-level storage area (XLC area) that adopts a multi-level storage mode and includes multiple multi-level storage cells. The specific value of the first predetermined number is not limited here.

[0056] It should be noted that the storage area can be any of the following: two-layer storage area (MLC area), three-layer storage area (TLC area), or four-layer storage area (QLC area). In this embodiment, the following description will only take the TLC area as an example.

[0057] S20, construct a virtual multi-level storage unit and establish a mapping relationship between the virtual multi-level storage unit and the single-level storage area; the single-level storage area contains at least one single-level storage unit.

[0058] A virtual multi-level storage unit (virtual XLC block) is constructed, and a mapping relationship is established between the virtual multi-level storage unit and the single-level storage area. One virtual multi-level storage unit corresponds to one single-level storage area; a single-level storage area contains at least one single-level storage unit. The size of its single-level storage area (i.e., the number of single-level storage units within it) depends on the type of the storage area. The type of the virtual multi-level storage unit is consistent with the type of the real multi-level storage unit. For example, if the multi-level storage unit in the real storage area is a TLC block, then the constructed virtual multi-level storage unit is a virtual TLC block.

[0059] For example, if the storage area is a TLC area, meaning the flash memory adopts a three-level storage mode, then the capacity of one TLC block can correspond to the capacity of three single-level storage cells. Furthermore, three single-level storage cells (SLC blocks) correspond to one virtual TLC block. That is, a mapping relationship is established between three single-level storage cells and one virtual TLC block, and these three single-level storage cells form a single-level storage area (SLC area).

[0060] Optionally, a virtual block table can be constructed to manage virtual multi-level storage units. This virtual block table can record the location information, sequence number, etc. of the virtual multi-level storage units, and the corresponding virtual multi-level storage units can be queried based on this virtual block table.

[0061] S30: Write data to a single-level storage cell in a single-level storage area.

[0062] Data is written sequentially to the single-level storage cells in the single-level storage area until the single-level storage cell is full of data.

[0063] In one implementation, such as Figure 2 As shown, this embodiment also includes: S40, determining whether the amount of data written in the flash memory is greater than a predetermined capacity threshold.

[0064] After writing data to a single-level storage cell, it is determined whether the total amount of data written to all single-level storage cells in the flash memory exceeds a predetermined capacity threshold. The specific value of the predetermined capacity threshold is not limited here.

[0065] For example, if flash memory adopts a three-level storage mode (TLC), a predetermined capacity threshold can be set to 1 / 3 of the TLC block capacity; that is, it is determined whether the total data write volume corresponding to all single-level storage cells in the flash memory is greater than 1 / 3 of the TLC block capacity. The capacity of the TLC block is not limited here.

[0066] If the amount of data written to the flash memory exceeds a predetermined capacity threshold, that is, if the amount of data written to all single-level storage areas exceeds the predetermined capacity threshold, the written data needs to be migrated. For example, if the flash memory adopts TLC storage mode, and the amount of data written to all single-level storage cells exceeds 1 / 3 of the TLC block capacity, then data migration is required. The specific steps include the following:

[0067] S41, establish the mapping relationship between virtual multi-level storage units and multi-level storage units; one virtual multi-level storage unit corresponds to one multi-level storage unit.

[0068] A mapping relationship is established between virtual multi-level storage units and multi-level storage units, where one virtual multi-level storage unit corresponds to one multi-level storage unit.

[0069] Optionally, a remapping table can be constructed to manage the mapping relationship between virtual multi-level storage units and multi-level storage units. This remapping table can record the sequence number and correspondence between virtual multi-level storage units and multi-level storage units. Based on this remapping table, it is possible to quickly query whether a mapping relationship exists between virtual multi-level storage units and multi-level storage units.

[0070] S42, based on the mapping relationship between the single-level storage area, the virtual multi-level storage unit, and the multi-level storage unit, migrate the data in the single-level storage area to the multi-level storage unit, and cancel the mapping relationship between the single-level storage area and the virtual multi-level storage unit.

[0071] Based on the mapping relationship established between single-level storage areas, virtual multi-level storage units, and multi-level storage units, the data written to each single-level storage unit within a single-level storage area is migrated to the multi-level storage unit mapped to the corresponding virtual multi-level storage unit. After the data migration is completed, the mapping relationship between the single-level storage area and the corresponding virtual multi-level storage unit is canceled. In one embodiment, as follows... Figure 3 As shown, step S42, "migrating data from the single-level storage area to the multi-level storage unit according to the mapping relationship between the single-level storage area, the virtual multi-level storage unit, and the multi-level storage unit," specifically includes the following steps:

[0072] S421, determine whether the single-level storage area mapped to the virtual multi-level storage unit is full of data.

[0073] S422, if the single-level storage area mapped to the virtual multi-level storage unit is full of data, then migrate the data of the single-level storage unit in the single-level storage area to the multi-level storage unit mapped to the corresponding virtual multi-level storage unit.

[0074] S423, if the single-level storage area mapped to the virtual multi-level storage unit is not full of data, then search for other virtual multi-level storage units until the single-level storage area mapped to other virtual multi-level storage units is full of data, then migrate the corresponding single-level storage area to the multi-level storage unit mapped to other virtual multi-level storage units.

[0075] Before migrating data from a virtual multi-level storage unit to its mapped multi-level storage unit, it's necessary to determine whether the single-level storage area mapped to the virtual multi-level storage unit is full. During data migration, the mapping relationships between the single-level storage area, the multi-level storage unit, and the virtual multi-level storage unit are used to migrate data from each single-level storage unit in a full single-level storage area to its corresponding real multi-level storage unit. Conversely, if the single-level storage units in the single-level storage area are not full, data migration cannot proceed.

[0076] If each single-level storage cell in the single-level storage area mapped to the virtual multi-level storage cell is full of data, then the data of all single-level storage cells in that single-level storage area will be migrated to the multi-level storage cell mapped to the corresponding virtual multi-level storage cell.

[0077] If a single-level storage area mapped to a virtual multi-level storage unit is not full of data, other virtual multi-level storage units are searched, and it is determined whether the corresponding single-level storage area is full of data. If it is full, the data in the single-level storage area is migrated to the multi-level storage unit mapped to the corresponding virtual multi-level storage unit. That is, other virtual multi-level storage units are searched among all virtual multi-level storage units until the single-level storage area mapped to the other virtual multi-level storage unit is full of data. Then, the data in the single-level storage area is migrated to the multi-level storage unit mapped to the other virtual multi-level storage unit.

[0078] Optionally, during this process, the corresponding virtual multi-level storage unit can be found according to the virtual block table to improve the search efficiency and the management efficiency of the virtual multi-level storage unit; and the multi-level storage unit mapped to the virtual multi-level storage unit can be found according to the remapping table, and then the data in the single-level storage area can be migrated to the multi-level storage unit mapped to the corresponding virtual multi-level storage unit.

[0079] In this embodiment, if the amount of data written in the flash memory is not greater than a predetermined capacity threshold, that is, if the amount of data written in all single-level storage areas is not greater than the predetermined capacity threshold, for example, if the flash memory adopts TLC storage mode and the amount of data written in all single-level storage cells is less than or equal to 1 / 3 of the TLC block capacity, this embodiment further includes the following steps:

[0080] S43 converts all multi-level storage cells of the flash memory into single-level storage cells and writes data to the single-level storage cells.

[0081] The process involves converting all multi-layer storage cells in the flash memory into single-layer storage cells, that is, converting all the multi-layer storage cells that have not yet been converted into single-layer storage cells one by one, and writing data into the single-layer storage cells to improve the efficiency of data writing.

[0082] Furthermore, after step S43, if the total data write volume of all converted single-level storage units exceeds a predetermined capacity threshold, such as... Figure 4 As shown, this embodiment also specifically includes the following steps:

[0083] S44, the second predetermined number of single-layer storage units are converted into multi-layer storage units, and a mapping relationship is established between the virtual multi-layer storage units and the multi-layer storage units.

[0084] A second predetermined number of single-level storage units are converted into multi-level storage units, and this second predetermined number is not limited here. The conversion process is as follows: each single-level storage unit is converted into a real multi-level storage unit, and the capacity of the converted multi-level storage unit is consistent with the capacity of the original multi-level storage unit.

[0085] Then, a mapping relationship is established between virtual multi-level storage units and real multi-level storage units, where one virtual multi-level storage unit corresponds to one multi-level storage unit. Optionally, this mapping relationship can be recorded and managed through a remapping table.

[0086] S45, migrate the data in the single-level storage area that is full of data to the multi-level storage unit mapped to the corresponding virtual multi-level storage unit, and cancel the mapping relationship between the single-level storage area and the virtual multi-level storage unit.

[0087] The process involves identifying virtual multi-level storage units that are mapped to a single-level storage area that is already filled with data, and identifying multi-level storage units that are mapped to these virtual multi-level storage units. Then, based on the mapping relationships between the single-level storage area, the virtual multi-level storage units, and the multi-level storage units, the data within each single-level storage unit in the single-level storage area is migrated to the multi-level storage unit mapped to the corresponding virtual multi-level storage unit. After the data migration is complete, the mapping relationship between the single-level storage area and the corresponding virtual multi-level storage unit is canceled.

[0088] In the data migration process described in this embodiment, the virtual multi-layer storage unit serves as an intermediate medium or bridge between the single-layer storage area and the multi-layer storage unit. Based on the mapping relationship between the single-layer storage area and the multi-layer storage unit and the virtual multi-layer storage unit, the data of each single-layer storage unit in the single-layer storage area is migrated to the real multi-layer storage unit, so that the capacity of the single-layer storage unit can reach up to 1 / N of the capacity of the multi-layer storage unit, thereby increasing the capacity of the single-layer storage unit.

[0089] Optionally, if not all multi-level storage units are converted to single-level storage units (i.e., if a predetermined number of multi-level storage units are converted to single-level storage units initially), and the total data write volume of the converted single-level storage units exceeds a predetermined capacity threshold (e.g., the total data write volume of all single-level storage units exceeds 1 / 3 of the TLC block capacity), then some single-level storage units can be converted to multi-level storage units according to steps S44-S45 above. The specific number of single-level storage units converted is not limited here. After the conversion, data migration can be performed to migrate the data in the filled single-level storage area to the corresponding actual multi-level storage units according to steps S41-S42 above.

[0090] In one implementation, such as Figure 5As shown, upon receiving a data read instruction, this embodiment further includes the following steps:

[0091] S50, upon receiving a data read instruction, locates the corresponding virtual multi-level storage unit according to the data read instruction and determines whether the virtual multi-level storage unit has a mapping relationship with the single-level storage area.

[0092] Upon receiving a data read instruction, the system locates the corresponding virtual multi-level storage unit based on the instruction, determining whether the virtual multi-level storage unit has a mapping relationship with a single-level storage area. This means confirming whether the virtual multi-level storage unit has established a mapping relationship with the single-level storage area. The data read instruction may carry information such as the data to be read and the sequence number of the virtual multi-level storage unit; the specific information is not limited here. The system then locates the corresponding virtual multi-level storage unit and reads the relevant data based on the information carried by the data read instruction. Optionally, this process can use a virtual block table to quickly locate the virtual multi-level storage unit.

[0093] S60, if there is a mapping relationship between the virtual multi-level storage unit and the single-level storage area, then read the data from the single-level storage area mapped to the virtual multi-level storage unit.

[0094] If there is a mapping relationship between the virtual multi-level storage unit and the single-level storage area, it means that the data written in the single-level storage area has not yet been migrated to the multi-level storage unit. That is, the data is stored in the single-level storage unit of the single-level storage area. Therefore, the relevant data can be read from the single-level storage area mapped to the virtual multi-level storage unit according to the mapping relationship between the virtual multi-level storage unit and the single-level storage area.

[0095] S70, if there is no mapping relationship between the virtual multi-level storage unit and the single-level storage area, then read the data from the multi-level storage unit mapped to the virtual multi-level storage unit.

[0096] If there is no mapping relationship between the virtual multi-level storage unit and the single-level storage area, that is, if the virtual multi-level storage unit has not established a mapping relationship with the single-level storage area, it means that the data has been stored in the multi-level storage unit, and thus the relevant data can be read from the multi-level storage unit that has a mapping relationship with the virtual multi-level storage unit. Optionally, this process can quickly find the multi-level storage unit that has a mapping relationship with the virtual multi-level storage unit based on the remapping table, thereby improving data reading efficiency.

[0097] In this application, in a first aspect, when converting a multi-layer storage unit into a single-layer storage unit, a virtual multi-layer storage unit is constructed, and this virtual multi-layer storage unit is associated with both the single-layer and multi-layer storage units, thereby eliminating the need to associate the single-layer storage unit with the multi-layer storage unit. This allows the capacity of the single-layer storage unit to reach a maximum of 1 / N of the multi-layer storage unit's capacity, thereby increasing the capacity of the single-layer storage unit, extending the duration of the single-layer storage unit's write performance, and improving data write efficiency. In a second aspect, the total data write volume is compared with a predetermined capacity threshold to determine whether data migration is needed or whether conversion to a single-layer storage unit is needed to improve data write efficiency, thereby improving the management efficiency of flash memory blocks. In a third aspect, when reading data, data can be read from the corresponding single-layer or multi-layer storage unit according to the mapping relationship between the virtual multi-layer storage unit and the single-layer storage unit, improving data read speed and enhancing user experience.

[0098] Example 2

[0099] Please refer to Figure 6 This application provides a flash memory block management device, which includes:

[0100] The conversion module 61 is used to convert a first predetermined number of multi-layer storage cells into single-layer storage cells in the storage area of ​​the flash memory; the storage area contains multiple multi-layer storage cells.

[0101] The construction module 62 is used to construct a virtual multi-layer storage unit and establish a mapping relationship between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage area contains at least one of the single-layer storage units.

[0102] The writing module 63 is used to write data to the single-layer storage unit in the single-layer storage area.

[0103] The flash memory block management device described above corresponds to the flash memory block management method of Embodiment 1; any of the options in Embodiment 1 are also applicable to this embodiment, and will not be described in detail here.

[0104] This application also provides a computer device, which includes a memory and at least one processor. The memory stores a computer program, and the processor executes the computer program to implement the flash memory block management method described above.

[0105] The memory may include a stored program area and a stored data area, wherein the stored program area may store the operating system and application programs required for at least one function; the stored data area may store data created based on the use of the computer device, etc. Furthermore, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0106] This application also provides a computer-readable storage medium storing machine-executable instructions. When called and executed by a processor, the machine-executable instructions cause the processor to perform the steps of the flash memory block management method described above.

[0107] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0108] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0109] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0110] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A flash memory block management method, characterized in that, include: In the storage area of ​​flash memory, a first predetermined number of multi-layer storage cells are converted into single-layer storage cells; the storage area contains multiple real multi-layer storage cells; A virtual multi-level storage unit with the same type as the real multi-level storage unit is constructed, and a mapping relationship is established between the virtual multi-level storage unit and the single-level storage area; the single-level storage area contains N single-level storage units; the virtual multi-level storage unit serves as an intermediate medium between the single-level storage area and the real multi-level storage unit, so that the total capacity of the single-level storage area can reach a maximum of 1 / N of the capacity of a single real multi-level storage unit; N is a non-zero natural number. Data is written to the single-level storage cell in the single-level storage area.

2. The flash memory block management method according to claim 1, characterized in that, Also includes: If the amount of data written to the flash memory is not greater than a predetermined capacity threshold, then all multi-layer storage cells of the flash memory are converted into single-layer storage cells, and data is written to the single-layer storage cells.

3. The flash memory block management method according to claim 2, characterized in that, Also includes: If the total data write volume of all single-level storage units after conversion is greater than the predetermined capacity threshold, then the second predetermined number of single-level storage units will be converted into multi-level storage units accordingly, and a mapping relationship between the virtual multi-level storage units and the multi-level storage units will be established. Based on the mapping relationship between the single-layer storage area, the virtual multi-layer storage unit, and the multi-layer storage unit, the data in the single-layer storage area that is full of data is migrated to the multi-layer storage unit, and the mapping relationship between the single-layer storage area and the virtual multi-layer storage unit is canceled.

4. The flash memory block management method according to claim 1, characterized in that, Also includes: If the amount of data written to the flash memory exceeds a predetermined capacity threshold, a mapping relationship is established between the virtual multi-layer storage unit and the multi-layer storage unit. One of the virtual multi-level storage units corresponds to one of the multi-level storage units; Based on the mapping relationship between the single-layer storage area, the virtual multi-layer storage unit, and the multi-layer storage unit, the data in the single-layer storage area is migrated to the multi-layer storage unit, and the mapping relationship between the single-layer storage area and the virtual multi-layer storage unit is canceled.

5. The flash memory block management method according to claim 4, characterized in that, Also includes: Upon receiving a data read instruction, the corresponding virtual multi-level storage unit is located according to the data read instruction, and it is determined whether the virtual multi-level storage unit has a mapping relationship with the single-level storage area. If so, data is read from the single-layer storage area mapped to the virtual multi-layer storage unit; If not, data is read from the multi-level storage unit mapped to the virtual multi-level storage unit.

6. The flash memory block management method according to claim 4, characterized in that, The step of migrating data from the single-level storage area to the multi-level storage unit based on the mapping relationship between the single-level storage area, the virtual multi-level storage unit, and the multi-level storage unit includes: Determine whether the single-layer storage area mapped to the virtual multi-layer storage unit is full of data; If so, the data in the single-layer storage area will be migrated to the multi-layer storage unit mapped to the corresponding virtual multi-layer storage unit; If not, search for other virtual multi-level storage units until the single-level storage area mapped to the other virtual multi-level storage units is full of data, then migrate the corresponding single-level storage area to the multi-level storage unit mapped to the other virtual multi-level storage units.

7. The flash memory block management method according to claim 1, characterized in that, The storage area can be any one of two-layer, three-layer, or four-layer storage areas.

8. A flash memory block management device, characterized in that, include: A conversion module is used to convert a first predetermined number of multi-layer storage cells into single-layer storage cells in the storage area of ​​flash memory; the storage area contains multiple real multi-layer storage cells; A construction module is used to construct a virtual multi-level storage unit that is consistent with the type of the real multi-level storage unit, and to establish a mapping relationship between the virtual multi-level storage unit and the single-level storage area; the single-level storage area contains N single-level storage units; the virtual multi-level storage unit serves as an intermediate medium between the single-level storage area and the real multi-level storage unit, so that the total capacity of the single-level storage area can reach a maximum of 1 / N of the capacity of a single real multi-level storage unit; N is a non-zero natural number. The write module is used to write data to the single-level storage unit in the single-level storage area.

9. A computer device, characterized in that, The computer device includes a memory and at least one processor, the memory storing a computer program, and the processor executing the computer program to implement the flash memory block management method according to any one of claims 1-7.

10. A computer storage medium, characterized in that, It stores a computer program, which, when executed, implements the flash memory block management method according to any one of claims 1-7.