CN115657948A - Flash block management method, device, equipment and storage medium - Google Patents

Flash block management method, device, equipment and storage medium Download PDF

Info

Publication number
CN115657948A
CN115657948A CN202211326817.9A CN202211326817A CN115657948A CN 115657948 A CN115657948 A CN 115657948A CN 202211326817 A CN202211326817 A CN 202211326817A CN 115657948 A CN115657948 A CN 115657948A
Authority
CN
China
Prior art keywords
layer
storage unit
layer storage
data
virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211326817.9A
Other languages
Chinese (zh)
Inventor
贾光俊
王斐
叶云杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Demingli Electronics Co Ltd
Original Assignee
Shenzhen Demingli Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Demingli Electronics Co Ltd filed Critical Shenzhen Demingli Electronics Co Ltd
Priority to CN202211326817.9A priority Critical patent/CN115657948A/en
Publication of CN115657948A publication Critical patent/CN115657948A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of flash memories, and discloses a flash memory block management method, a flash memory block management device, flash memory block management equipment and a storage medium, wherein the method comprises the following steps: converting a first preset number of multi-layer memory units into single-layer memory units in a memory area of a flash memory; the memory area includes a plurality of multi-layer memory cells; constructing a virtual multi-layer storage unit and establishing a mapping relation between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage region includes at least one single-layer memory cell; and writing data into the single-layer memory cells in the single-layer memory area. 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 is not required 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 to the maximum extent, and the data writing efficiency is improved.

Description

Flash block management method, device, equipment and storage medium
Technical Field
The present application relates to the field of flash memory technologies, and in particular, to a flash block management method, apparatus, device, and storage medium.
Background
Solid State Disk (SSD), fixed Disk for short, is increasingly widely used in people's lives because of its better performance. The storage medium adopted by the current mainstream SSD is a FLASH MEMORY (NAND FLASH), the data of the NAND FLASH is stored in a storage unit (MEMORY CELL) in a bit (bit) manner, and the storage unit can be divided into a Single-layer storage unit (SLC, single-Level CELL), a two-layer storage unit (MLC, multi-Level CELL), a four-layer storage unit (QLC, quad-Level CELL) and a Multi-layer storage unit (XLC, X-Level CELL) according to the number of bits stored in each storage unit. The storage unit has inverse relationship between the read-write speed and the capacity, so that the SLC has the smallest capacity, but the highest read-write speed and the highest reliability.
In order to improve the writing performance of the solid state disk, the XLC memory unit (such as MLC, TLC, QLC, etc.) is divided into partial areas and converted into a single-layer memory unit (for use in a dynamic SLC cache). When the solid state disk writes data, the data are written into the single-layer storage unit, and then the data in the single-layer storage unit are moved to the multi-layer storage unit.
When the multi-layer memory unit is converted into the single-layer memory unit, the maximum capacity of the single-layer memory unit can only reach 1/(N + 1) of the capacity of the multi-layer memory unit and cannot reach 1/N, so that the data writing efficiency is low. Therefore, how to increase the conversion capacity of the single-layer memory cell so as to increase the initial state writing performance duration of the solid state disk is an urgent problem to be solved.
Disclosure of Invention
In view of the above, to solve the problems in the prior art, the present application provides a flash block management method, apparatus, device and storage medium.
In a first aspect, the present application provides a flash block management method, including:
converting a first preset number of multi-layer memory units into single-layer memory units in a memory area of a flash memory; the storage area comprises a plurality of multi-layer storage units;
constructing a virtual multi-layer storage unit and establishing a mapping relation between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage region comprises at least one single-layer storage unit;
and writing data into the single-layer storage units in the single-layer storage area.
In an alternative embodiment, the method further comprises:
and if the data writing quantity of the flash memory is not larger than a preset capacity threshold value, converting all multilayer storage units of the flash memory into single-layer storage units, and writing data into the single-layer storage units.
In an alternative embodiment, the method further comprises:
if the total data writing quantity of all the converted single-layer storage units is larger than the preset capacity threshold value, correspondingly converting a second preset number of the single-layer storage units into multi-layer storage units, and establishing a mapping relation between the virtual multi-layer storage units and the multi-layer storage units;
and migrating the data in the single-layer storage area which is fully written with data to the multilayer storage unit according to the mapping relation among the single-layer storage area, the virtual multilayer storage unit and the multilayer storage unit, and canceling the mapping relation between the single-layer storage area and the virtual multilayer storage unit.
In an alternative embodiment, the method further comprises:
if the data writing amount of the flash memory is larger than a preset capacity threshold value, establishing a mapping relation between the virtual multilayer storage unit and the multilayer storage unit; one virtual multi-layer storage unit corresponds to one multi-layer storage unit;
and migrating the data in the single-layer storage area to the multilayer storage unit according to the mapping relation among the single-layer storage area, the virtual multilayer storage unit and the multilayer storage unit, and canceling the mapping relation between the single-layer storage area and the virtual multilayer storage unit.
In an alternative embodiment, the method further comprises:
when a data reading instruction is received, searching a corresponding virtual multi-layer storage unit according to the data reading instruction, and judging whether the virtual multi-layer storage unit has a mapping relation with the single-layer storage area;
if yes, reading data from a single-layer storage area mapped with the virtual multi-layer storage unit;
and if not, reading data from the multilayer storage unit mapped with the virtual multilayer storage unit.
In an optional embodiment, the migrating data in the single-layer storage area to the multi-layer storage unit according to a mapping relationship among the single-layer storage area, the virtual multi-layer storage unit, and the multi-layer storage unit includes:
judging whether the single-layer storage area mapped with the virtual multi-layer storage unit is full of data or not;
if so, migrating the data in the single-layer storage area to a multilayer storage unit mapped with the corresponding virtual multilayer storage unit;
if not, searching other virtual multi-layer storage units until the single-layer storage areas mapped with the other virtual multi-layer storage units are full of data, and migrating the corresponding single-layer storage areas to the multi-layer storage units mapped with the other virtual multi-layer storage units.
In an alternative embodiment, the memory area is any one of a two-layer memory area, a three-layer memory area, and a four-layer memory area.
In a second aspect, the present application provides a flash block management apparatus, comprising:
the conversion module is used for converting the first preset number of multilayer memory units into single-layer memory units in a memory area of the flash memory; the storage area comprises a plurality of multi-layer storage units;
the device comprises a construction module, a storage module and a storage module, wherein the construction module is used for constructing a virtual multi-layer storage unit and establishing a mapping relation between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage region includes at least one single-layer storage unit;
and the writing module is used for writing data into the single-layer storage unit in the single-layer storage area.
In a third aspect, the present application provides a computer device comprising a memory storing a computer program and at least one processor for executing the computer program to implement the aforementioned flash block management method.
In a fourth aspect, the present application provides a computer storage medium storing a computer program which, when executed, implements a flash block management method according to the foregoing.
The embodiment of the application has the following beneficial effects:
the embodiment of the application provides a flash memory block management method, which comprises the steps of converting a first preset number of multilayer memory units into single-layer memory units in a memory area of a flash memory; the storage area comprises a plurality of multi-layer storage units; constructing a virtual multi-layer storage unit and establishing a mapping relation between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage region comprises at least one single-layer memory cell; and writing data into the single-layer memory cells in the single-layer memory area. According to the embodiment of the application, when the multilayer storage unit is converted into the single-layer storage unit, the virtual multilayer storage unit is constructed and is respectively associated with the single-layer storage unit and the multilayer storage unit, so that the single-layer storage unit is not required 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 to the maximum extent, the duration time of the write-in performance of the single-layer storage unit is prolonged, and the data write-in efficiency is improved.
Drawings
To more clearly illustrate the technical solutions of the present application, the drawings required for use in the embodiments will be briefly described below, and it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope of the present application. Like components are numbered similarly in the various figures.
FIG. 1 is a schematic diagram showing a first implementation of a flash block management method in an embodiment of the present application;
FIG. 2 is a diagram showing a second implementation of the flash block management method in the embodiment of the present application;
FIG. 3 is a schematic diagram illustrating a third implementation of a flash block management method in an embodiment of the present application;
FIG. 4 is a diagram showing a fourth implementation of the flash block management method in the embodiment of the present application;
FIG. 5 is a diagram showing a fifth implementation of the flash block management method in the embodiment of the present application;
fig. 6 shows a schematic structural diagram of a flash block management device in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments.
The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as presented in the figures, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present application, are intended to indicate only specific features, numerals, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the presence of or adding to one or more other features, numerals, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the present application belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments.
In the storage mode of the solid state disk, single-layer storage represents that one storage unit stores 1-bit data, and multilayer storage represents that one storage unit stores n-bit data, wherein n =2,3,4, \ 8230; the decision of which storage medium to use to provide matching data input and output performance can be made based on traffic load conditions. Under the multi-layer storage mode, the read-write mode of the data block is different from the read-write mode of the single-layer storage. Data can be directly read from a storage medium in a single-layer storage mode, the data can be preferentially written into the topmost storage medium in a multi-layer storage mode by default, and the data needs to be moved to the topmost storage medium firstly during reading. Specifically, the method comprises the following steps: when data is written, a new data block is written into the topmost storage medium by default; if the storage space of the topmost storage medium is full, the server stores the data in the next storage medium; if all the storage media are full of data, the server can eliminate outdated data according to a cache elimination strategy specified by a user; if the expired data cannot be eliminated and all available storage space is full, the data cannot be written. When data is read, cold data is transparently dumped into a storage medium at a lower layer in a multi-layer storage mode, and the read data heats and places the data into a top-layer storage.
Furthermore, in order to improve the writing performance of the solid state disk, the XLC memory unit (such as MLC, TLC, QLC, etc.) is divided into partial areas and converted into single-layer memory units (used by the dynamic SLC cache). When the solid state disk writes data, the data is written into a single-layer memory unit (SLC Block), and then the data in the single-layer memory unit is transferred into a multi-layer memory unit.
When data is written, a single-layer storage unit is applied first, and a real multi-layer storage unit is applied at the same time, so that the single-layer storage unit and the multi-layer storage unit are bound. Therefore, the maximum capacity of the single-layer memory cell can only reach 1/(N + 1) of the capacity of the XLC block. Wherein, if the memory cell of the flash memory is MLC, N =2; when the storage unit of the flash memory is TLC, N =3; when the memory cell of the flash memory is QLC, N =4.
Specifically, for example, a TLC Block (TLC Block) is taken as an example, assuming that the capacity of a solid state disk is 60G, only 45G TLC spaces including TLC Block1, TLC Block2 and TLC Block3 can be correspondingly converted into a 15GSLC Block space, and when data is written, assuming that a 15G SLC Block space is applied, the application TLC Block 4G space needs to be bound with the SLC Block space at the same time, so that after conversion, the maximum capacity of a single-layer memory cell can only reach 1/(N + 1) of the capacity of a multi-layer memory cell.
Therefore, the embodiment provides a flash block management method, which is used for improving the conversion quality of a multi-layer storage unit to a single-layer storage unit, 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, so as to improve the data writing efficiency and the duration of the initial state writing performance of a solid state disk.
Example 1
Referring to fig. 1, an embodiment of the present application provides a flash block management method, which is described in detail below.
S10, converting a first preset number of multilayer storage units into single-layer storage units in a storage area of a flash memory; the memory area includes a plurality of multi-level memory cells.
Before data writing in the solid state disk, firstly, correspondingly converting a first preset number of multilayer storage units (XLC blocks) in a storage area of a flash memory of the solid state disk into single-layer storage units (SLC blocks) one by one, wherein the storage area is a multilayer storage area (XLC area) adopting a multilayer storage mode and comprises a plurality of multilayer storage units; the specific value of the first predetermined number is not limited herein.
It should be noted that the storage area is any one of a two-layer storage area (MLC area), a three-layer storage area (TLC area), and a four-layer storage area (QLC area), and the storage area is only used as the TLC area in the following description of the present embodiment.
S20, constructing a virtual multi-layer storage unit and establishing a mapping relation between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage region includes at least one single-layer memory cell.
Constructing virtual multi-layer storage units (virtual XLC blocks), and establishing a mapping relation between the virtual multi-layer storage units and single-layer storage areas, wherein one virtual multi-layer storage unit corresponds to one single-layer storage area; a single-layer storage region contains at least one single-layer memory cell. The size of the single-layer storage area (i.e. the number of single-layer storage units in the single-layer storage area) depends on the type of the storage area, and the type of the virtual multi-layer storage unit is consistent with the type of the real multi-layer storage unit, for example, if the multi-layer storage unit in the real storage area is a TLC block, the constructed virtual multi-layer storage unit is a virtual TLC block.
For example, if the storage region is a TLC region, i.e., the flash memory adopts a three-layer storage mode, the capacity of one TLC block may correspond to the capacity of three single-layer memory cells. Furthermore, three single-layer memory cells (SLC blocks) correspond to one virtual TLC block, i.e., a mapping is established between the three single-layer memory cells, which constitute one single-layer memory region (SLC region), and one virtual TLC block.
Optionally, a virtual block table may be constructed to manage the virtual multi-layer storage unit, where the virtual block table may record location information, sequence numbers, and the like of the virtual multi-layer storage unit, and the corresponding virtual multi-layer storage unit may be queried according to the virtual block table.
And S30, writing data into the single-layer storage unit in the single-layer storage area.
And writing data into the single-layer storage units in the single-layer storage area in sequence until the single-layer storage units are fully written with data.
In one embodiment, as shown in fig. 2, this embodiment further includes: s40, judging whether the data writing quantity in the flash memory is larger than a preset capacity threshold value or not.
After data is written into the single-layer memory cells, whether the total data writing quantity of all the single-layer memory cells in the flash memory is larger than a preset capacity threshold value or not is judged. The specific value of the predetermined capacity threshold is not limited herein.
For example, the flash memory may assume a three-level storage mode (TLC), and the predetermined capacity threshold may be set to 1/3 of the TLC block capacity; that is, it is determined whether the total data writing amount corresponding to all the single-layer memory cells in the flash memory is greater than 1/3 of the capacity of the TLC block. The capacity of the TLC block is not limited herein.
If the data write-in amount in the flash memory is greater than the predetermined capacity threshold, that is, the data write-in amount of all the single-layer storage areas is greater than the predetermined capacity threshold, data migration is required to be performed on the written-in data, for example, if the flash memory adopts a TLC storage mode and the data write-in amount of all the single-layer storage units is greater than 1/3 of the capacity of a TLC block, data migration is required; the method specifically comprises the following steps:
s41, establishing a mapping relation between the virtual multilayer storage unit and the multilayer storage unit; one virtual multi-level memory cell corresponds to one multi-level memory cell.
A mapping relationship is established between the virtual multi-layer storage units and the multi-layer storage units, wherein one virtual multi-layer storage unit corresponds to one multi-layer storage unit.
Optionally, a remapping table may be constructed, where the remapping table is used to manage the mapping relationship between the virtual multi-layer storage unit and the multi-layer storage unit, and the remapping table may record the serial number, the corresponding relationship, and the like corresponding to the virtual multi-layer storage unit and the multi-layer storage unit; according to the remapping table, whether the mapping relation exists between the virtual multi-layer storage unit and the multi-layer storage unit can be rapidly inquired.
And S42, migrating the data in the single-layer storage area to the multilayer storage unit according to the mapping relation among the single-layer storage area, the virtual multilayer storage unit and the multilayer storage unit, and canceling the mapping relation between the single-layer storage area and the virtual multilayer storage unit.
According to the mapping relationship established among the single-layer storage area, the virtual multi-layer storage units and the multi-layer storage units, data written in each single-layer storage unit in the single-layer storage area is migrated to the multi-layer storage unit mapped with the corresponding virtual multi-layer storage unit, and after the data migration is completed, the mapping relationship between the single-layer storage area and the corresponding virtual multi-layer storage unit is cancelled. In one embodiment, as shown in fig. 3, the step S42 of "migrating data in a single-layer storage area to a multi-layer storage unit according to a mapping relationship among the single-layer storage area, the virtual multi-layer storage unit, and the multi-layer storage unit" specifically includes the following steps:
s421, determine whether the single-layer storage area mapped with the virtual multi-layer storage unit is full of data.
S422, if the single-layer storage area mapped to the virtual multi-layer storage unit is full of data, migrating the data in the single-layer storage area to the multi-layer storage unit mapped to the corresponding virtual multi-layer storage unit.
And S423, if the single-layer storage area mapped with the virtual multi-layer storage unit is not fully written with data, searching other virtual multi-layer storage units until the single-layer storage area mapped with other virtual multi-layer storage units is fully written with data, and migrating the corresponding single-layer storage area to the multi-layer storage unit mapped with other virtual multi-layer storage units.
Before migrating data in the virtual multi-layer storage unit to the mapped multi-layer storage unit, whether a single-layer storage area mapped with the virtual multi-layer storage unit is full of data needs to be judged, and when data migration is carried out, data of each single-layer storage unit in the single-layer storage area full of data are migrated to a corresponding real multi-layer storage unit through mapping relations between the single-layer storage area and the virtual multi-layer storage unit respectively. Furthermore, if each single-layer memory cell in the single-layer memory area is not full of data, data migration cannot be performed thereon.
And if each single-layer storage unit in the single-layer storage area mapped with the virtual multi-layer storage unit is full of data, migrating the data of all the single-layer storage units in the single-layer storage area to the multi-layer storage unit mapped with the corresponding virtual multi-layer storage unit.
If the single-layer storage area mapped with the virtual multi-layer storage unit has the data which is not written with the single-layer storage unit, searching other virtual multi-layer storage units, determining whether the single-layer storage area corresponding to the virtual multi-layer storage unit is written with the data, and if the single-layer storage area is written with the data, transferring the data in the single-layer storage area to the multi-layer storage unit mapped with the corresponding virtual multi-layer storage unit; that is, other virtual multi-layer storage units are searched in all the virtual multi-layer storage units, and until the single-layer storage area mapped to the other virtual multi-layer storage units is full of data, the data in the single-layer storage area is migrated to the multi-layer storage unit mapped to the corresponding other virtual multi-layer storage unit.
Optionally, in this process, the corresponding virtual multi-layer storage unit may be searched according to the virtual block table, so as to improve the search efficiency and the management efficiency of the virtual multi-layer storage unit; and searching the multilayer storage unit mapped with the virtual multilayer storage unit according to the remapping table, and then migrating the data in the single-layer storage area to the multilayer storage unit mapped with the corresponding virtual multilayer storage unit.
In this embodiment, if the data writing amount in the flash memory is not greater than the predetermined capacity threshold, that is, the data writing amount in all the single-layer storage areas is not greater than the predetermined capacity threshold, for example, if the flash memory adopts the TLC storage mode and the data writing amount in all the single-layer storage units is less than or equal to 1/3 of the capacity of the TLC block, this embodiment further includes the following steps:
and S43, converting all the multilayer memory cells of the flash memory into single-layer memory cells, and writing data into the single-layer memory cells.
All the multi-layer storage units in the flash memory are correspondingly converted into single-layer storage units, namely, all the multi-layer storage units which are not converted are correspondingly converted into single-layer storage units one by one, data are written into the single-layer storage units, and the data writing efficiency is improved.
Further, after step S43, if the total data writing amount of all converted single-layer memory cells is greater than the predetermined capacity threshold, as shown in fig. 4, the embodiment further specifically includes the following steps:
and S44, correspondingly converting the second preset number of single-layer storage units into multi-layer storage units, and establishing a mapping relation between the virtual multi-layer storage units and the multi-layer storage units.
Correspondingly converting a second predetermined number of single-layer memory cells into multi-layer memory cells, where the second predetermined number is not limited herein. The conversion process is that the single-layer storage units are converted into real multilayer storage units in a one-to-one correspondence mode, and the capacity of the converted multilayer storage units is consistent with that of the original multilayer storage units.
And then, establishing a mapping relation between the virtual multi-layer storage units and the real multi-layer storage units, wherein one virtual multi-layer storage unit corresponds to one multi-layer storage unit. Alternatively, the mapping relationship may be recorded and managed by a remapping table.
And S45, migrating the data in the single-layer storage area which is fully written with the data to the multilayer storage unit which is mapped with the corresponding virtual multilayer storage unit, and canceling the mapping relation between the single-layer storage area and the virtual multilayer storage unit.
The method comprises the steps of searching a virtual multi-layer storage unit which has a mapping relation with a single-layer storage area which is fully written with data, and searching a multi-layer storage unit which has a mapping relation with the virtual multi-layer storage unit. And then according to the mapping relation among the single-layer storage area, the virtual multi-layer storage units and the multi-layer storage units, migrating the data in each single-layer storage unit in the single-layer storage area to the multi-layer storage unit mapped with the corresponding virtual multi-layer storage unit, and after the data migration is finished, canceling the mapping relation between the single-layer storage area and the corresponding virtual multi-layer storage unit.
In the data migration process described in this embodiment, the virtual multi-layer storage unit serves as an intermediate medium or a bridge between the single-layer storage area and the multi-layer storage unit; therefore, according to the mapping relation between the single-layer storage area and the virtual multi-layer storage unit and the mapping relation between the virtual multi-layer storage unit and the multi-layer storage unit, the data of each single-layer storage unit in the single-layer storage area are migrated to the real multi-layer storage unit, the capacity of the single-layer storage unit can reach 1/N of the capacity of the multi-layer storage unit to the maximum, and the capacity of the single-layer storage unit is improved.
Optionally, when not all the multi-layer memory cells are correspondingly converted into single-layer memory cells, that is, when a predetermined number of multi-layer memory cells are converted into single-layer memory cells in an early stage, if a total data write amount of the converted single-layer memory cells is greater than a predetermined capacity threshold, for example, the total data write amount of all the single-layer memory cells exceeds 1/3 of a capacity of a TLC block, a part of the single-layer memory cells may also be converted into multi-layer memory cells according to the steps of the foregoing steps S44 to S45, where the number of the specific converted single-layer memory cells is not limited herein. After the conversion is realized, data migration can be further performed, and the data of the single-layer storage area which is fully written with data is migrated to the corresponding real multi-layer storage unit according to the steps of the steps S41-S42.
In an embodiment, as shown in fig. 5, when a data reading instruction is received, the present embodiment further specifically includes the following steps:
s50, when a data reading instruction is received, searching a corresponding virtual multi-layer storage unit according to the data reading instruction, and judging whether the virtual multi-layer storage unit has a mapping relation with the single-layer storage area.
When a data reading instruction is received, searching a corresponding virtual multi-layer storage unit according to the data reading instruction, judging whether the virtual multi-layer storage unit has a mapping relation with a single-layer storage area, namely determining whether the virtual multi-layer storage unit has a mapping relation with the single-layer storage area. The data reading command may carry information such as data to be read and a serial number of the virtual multi-layer memory cell, and specific information is not limited herein, so that the corresponding virtual multi-layer memory cell and the read related data are searched according to the information carried by the data reading command. Optionally, the process may quickly find the virtual multi-layer storage unit according to the virtual block table.
And S60, if the virtual multi-layer storage unit and the single-layer storage area have a mapping relation, reading data from the single-layer storage area mapped with the virtual multi-layer storage unit.
If the mapping relationship between the virtual multi-layer storage unit and the single-layer storage area exists, which indicates that the data written in the single-layer storage area has not been migrated to the multi-layer storage unit, that is, the data is stored in the single-layer storage unit of the single-layer storage area, the relevant data may be read from the single-layer storage area mapped to the virtual multi-layer storage unit according to the mapping relationship between the virtual multi-layer storage unit and the single-layer storage area.
And S70, if the virtual multi-layer storage unit and the single-layer storage area have no mapping relation, reading data from the multi-layer storage unit mapped with the virtual multi-layer storage unit.
If the mapping relationship does not exist between the virtual multi-layer storage unit and the single-layer storage area, that is, the virtual multi-layer storage unit does not establish the mapping relationship with the single-layer storage area, it indicates that the data has been stored in the multi-layer storage unit, so that the related data can be read from the multi-layer storage unit having the mapping relationship with the virtual multi-layer storage unit. Optionally, in the process, the multi-layer storage unit having the mapping relationship with the virtual multi-layer storage unit can be quickly searched according to the remapping table, so that the data reading efficiency is improved.
In the embodiment of the application, on the first aspect, when a multilayer storage unit is converted into a single-layer storage unit, a virtual multilayer storage unit is constructed and 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 to the maximum extent, the capacity of the single-layer storage unit is improved, the duration of the write-in performance of the single-layer storage unit is prolonged, and the data write-in efficiency is improved; in the second aspect, the total data write-in amount is compared with a preset capacity threshold value to determine whether data migration is needed or whether data needs to be converted into a single-layer storage unit to improve data write-in efficiency, so that the management efficiency of the flash memory block is improved; in the third aspect, when data is read, the data can be read from the corresponding single-layer storage unit or multi-layer storage unit according to the mapping relation between the virtual multi-layer storage unit and the single-layer storage unit, so that the data reading speed is increased, and the user experience effect is improved.
Example 2
Referring to fig. 6, an embodiment of the present application provides a flash block management apparatus, including:
a conversion module 61, configured to convert a first predetermined number of multi-layer memory cells into single-layer memory cells in a memory area of a flash memory; the storage area comprises a plurality of multi-layer storage units;
a building module 62, configured to build a virtual multi-layer storage unit, and build a mapping relationship between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage region includes at least one single-layer storage unit;
and a writing module 63, configured to write data into the single-layer memory cells in the single-layer memory area.
The flash block management device described above corresponds to the flash 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.
The embodiment of the present application further provides a computer device, which includes a memory and at least one processor, where the memory stores a computer program, and the processor is configured to execute the computer program to implement the flash memory block management method of the foregoing embodiment.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the computer device, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The embodiments of the present application also provide a computer-readable storage medium, which stores machine executable instructions, and when the computer executable instructions are called and executed by a processor, the computer executable instructions cause the processor to execute the steps of the flash memory block management method of the above embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions may be stored in a computer-readable storage medium if they are implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application.

Claims (10)

1. A flash block management method, comprising:
converting a first preset number of multi-layer memory units into single-layer memory units in a memory area of a flash memory; the storage area comprises a plurality of multi-layer storage units;
constructing a virtual multi-layer storage unit and establishing a mapping relation between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage region comprises at least one single-layer storage unit;
and writing data into the single-layer storage units in the single-layer storage area.
2. The flash block management method according to claim 1, further comprising:
and if the data writing amount of the flash memory is not larger than a preset capacity threshold value, converting all the multilayer storage units of the flash memory into single-layer storage units, and writing data into the single-layer storage units.
3. The flash block management method according to claim 2, further comprising:
if the total data writing quantity of all the converted single-layer storage units is larger than the preset capacity threshold value, correspondingly converting a second preset quantity of the single-layer storage units into multi-layer storage units, and establishing a mapping relation between the virtual multi-layer storage units and the multi-layer storage units;
and migrating the data in the single-layer storage area which is fully written with data to the multilayer storage unit according to the mapping relation among the single-layer storage area, the virtual multilayer storage unit and the multilayer storage unit, and canceling the mapping relation between the single-layer storage area and the virtual multilayer storage unit.
4. The flash block management method according to claim 1, further comprising:
if the data writing amount of the flash memory is larger than a preset capacity threshold value, establishing a mapping relation between the virtual multilayer storage unit and the multilayer storage unit; one virtual multi-layer storage unit corresponds to one multi-layer storage unit;
and migrating the data in the single-layer storage area to the multilayer storage unit according to the mapping relation among the single-layer storage area, the virtual multilayer storage unit and the multilayer storage unit, and canceling the mapping relation between the single-layer storage area and the virtual multilayer storage unit.
5. The flash block management method according to claim 4, further comprising:
when a data reading instruction is received, searching a corresponding virtual multi-layer storage unit according to the data reading instruction, and judging whether the virtual multi-layer storage unit has a mapping relation with the single-layer storage area;
if yes, reading data from a single-layer storage area mapped with the virtual multi-layer storage unit;
and if not, reading data from the multilayer storage unit mapped with the virtual multilayer storage unit.
6. The flash memory block management method according to claim 4, wherein the migrating data in the single-layer memory area to the multi-layer memory unit according to the mapping relationship among the single-layer memory area, the virtual multi-layer memory unit and the multi-layer memory unit comprises:
judging whether the single-layer storage area mapped with the virtual multi-layer storage unit is full of data or not;
if so, migrating the data in the single-layer storage area to a multilayer storage unit mapped with the corresponding virtual multilayer storage unit;
if not, searching other virtual multi-layer storage units until the single-layer storage areas mapped with the other virtual multi-layer storage units are full of data, and migrating the corresponding single-layer storage areas to the multi-layer storage units mapped with the other virtual multi-layer storage units.
7. The flash block management method according to claim 1, wherein the storage area is any one of a two-tier storage area, a three-tier storage area, and a four-tier storage area.
8. A flash block management apparatus, comprising:
the conversion module is used for converting a first preset number of multi-layer storage units into single-layer storage units in a storage area of the flash memory; the storage area comprises a plurality of multi-layer storage units;
the device comprises a construction module, a storage module and a storage module, wherein the construction module is used for constructing a virtual multi-layer storage unit and establishing a mapping relation between the virtual multi-layer storage unit and a single-layer storage area; the single-layer storage region comprises at least one single-layer storage unit;
and the writing module is used for writing data into the single-layer storage unit in the single-layer storage area.
9. A computer device, characterized in that the computer device comprises a memory storing a computer program and at least one processor for executing the computer program to implement the flash block management method according to any of claims 1-7.
10. A computer storage medium characterized in that it stores a computer program that, when executed, implements the flash block management method according to any one of claims 1-7.
CN202211326817.9A 2022-10-25 2022-10-25 Flash block management method, device, equipment and storage medium Pending CN115657948A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211326817.9A CN115657948A (en) 2022-10-25 2022-10-25 Flash block management method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211326817.9A CN115657948A (en) 2022-10-25 2022-10-25 Flash block management method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115657948A true CN115657948A (en) 2023-01-31

Family

ID=84993415

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211326817.9A Pending CN115657948A (en) 2022-10-25 2022-10-25 Flash block management method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115657948A (en)

Similar Documents

Publication Publication Date Title
US11416391B2 (en) Garbage collection
US8332576B2 (en) Data reading method for flash memory and controller and storage system using the same
US8356136B2 (en) Block management method of a non-volatile memory
US8417872B2 (en) Write and merge methods in memory card systems for reducing the number of page copies
US8341336B2 (en) Region-based management method of non-volatile memory
US20100318760A1 (en) Memory controller, nonvolatile storage device, and nonvolatile storage system
US20100082878A1 (en) Memory controller, nonvolatile storage device, nonvolatile storage system, and data writing method
US8694748B2 (en) Data merging method for non-volatile memory module, and memory controller and memory storage device using the same
KR102240261B1 (en) Memory management
US9141530B2 (en) Data writing method, memory controller and memory storage device
US10073771B2 (en) Data storage method and system thereof
US9383929B2 (en) Data storing method and memory controller and memory storage device using the same
JP5592478B2 (en) Nonvolatile storage device and memory controller
TWI470432B (en) Electronic system and flash memory managing method thereof
CN110688256A (en) Metadata power-on recovery method and device, electronic equipment and storage medium
CN112596668A (en) Bad block processing method and system for memory
US9001585B1 (en) Data writing method, memory control circuit unit and memory storage apparatus
CN107193485B (en) Storage device, control unit thereof and data storage method for storage device
CN115657948A (en) Flash block management method, device, equipment and storage medium
US9830077B2 (en) Data writing method, memory control circuit unit and memory storage apparatus
KR100780963B1 (en) Memory card and driving method thereof
TWI752784B (en) Unbalanced plane management method, associated data storage device and controller thereof
JP4818453B1 (en) Electronic device and data reading method
CN111897676A (en) File backup method and device based on database index
CN112486416B (en) Data processing method, device, storage medium and processor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination