Superblock management method, apparatus and electronic device

By constructing a superblock management method and using a minimum heap container to manage NandFlash storage blocks, write operations and garbage collection are optimized, solving the problem of low efficiency in garbage collection and wear leveling in SSD firmware and improving SSD performance.

CN119902704BActive Publication Date: 2025-11-04SHENZHEN CITY TECHWIN SEMICONDUCTOR COMPANY LIMITED
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411821225.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-11-04
Estimated Expiration
2044-12-11

AI Technical Summary

Technical Problem

In existing technologies, the garbage collection and wear leveling algorithms of SSD firmware are inefficient and urgently need to be improved.

Method used

By constructing a superblock management method, storage blocks in NandFlash are managed using a min-heap container, optimizing write operations and garbage collection operations. This includes initializing the min-heap container, constructing the superblock, writing data structures of different states into different min-heaps, and managing write operations and garbage collection.

Benefits of technology

Improved the efficiency of garbage collection and wear leveling algorithms in SSD firmware, and optimized the performance of NandFlash.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119902704B_ABST
    Figure CN119902704B_ABST
Patent Text Reader

Abstract

The application provides a super block management method and device and electronic equipment, comprising: obtaining a target storage block in a storage unit in a plurality of NandFlash; the block number of the target storage block is the same; initializing a minimum heap container; constructing a super block according to the target storage block; writing a first data structure of a first sub-super block in the super block in a full data state into a first minimum heap in the minimum heap container; and writing a second data structure of a second sub-super block in the super block in an unwritten data state into a second minimum heap in the minimum heap container; and managing the write operation and the garbage collection operation of the super block through the first minimum heap and the second minimum heap. The method improves the garbage collection and wear leveling algorithm efficiency of the SSD firmware.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data storage, in particular to a super block management method and device and electronic equipment. BACKGROUND

[0002] Solid state disk (SSD) is widely used in consumer and enterprise storage, and currently, the SSD uses Nand Flash as a medium. Due to the physical characteristic limitation, the firmware in the industry solid state disk needs to perform wear leveling and garbage collection tasks at regular intervals.

[0003] At present, the technical problem of how to improve the efficiency of the garbage collection and wear leveling algorithm of the SSD firmware needs to be solved. SUMMARY

[0004] The present application aims to provide a super block management method and device and electronic equipment to solve the technical problem of improving the efficiency of the garbage collection and wear leveling algorithm of the SSD firmware, thereby improving the garbage collection and wear leveling performance of the SSD firmware.

[0005] In a first aspect, the present application provides a super block management method, comprising: obtaining a target storage block in a storage unit in a plurality of NandFlash; the block number of the target storage block is the same; initializing a minimum heap container; constructing a super block according to the target storage block; writing a first data structure of a first sub-super block in the super block in a full data state into a first minimum heap in the minimum heap container; and writing a second data structure of a second sub-super block in the super block in an unwritten data state into a second minimum heap in the minimum heap container; managing the write operation and the garbage collection operation of the super block through the first minimum heap and the second minimum heap.

[0006] In a preferred embodiment of the present application, the key of the first minimum heap is the available resource quantity of the first data structure; the minimum heap head of the first minimum heap is the target first sub-super block with the smallest available resource quantity in the first data structure; the key of the second minimum heap is the erase count of the second data structure; and the minimum heap head of the second minimum heap is the target second sub-super block with the smallest erase count in the second data structure.

[0007] In a preferred embodiment of the present application, the step of managing the write operation of the super block through the first minimum heap and the second minimum heap comprises: when a write command is received, the target second sub-super block is called from the second minimum heap; a write operation is performed on the target second sub-super block according to the write command until the target second sub-super block is full, obtaining a full data target second sub-super block; and the full data target second sub-super block is put into the first minimum heap.

[0008] In the preferred embodiment of the present application, after the step of retrieving the target second sub-superblock from the second min-heap, the method comprises: placing a target third sub-superblock with the least number of erasures in the second data structure at the head of the second min-heap.

[0009] In the preferred embodiment of the present application, the step of placing the target second sub-superblock full of data in the first min-heap comprises: performing a min-heap push operation to place the target second sub-superblock full of data in the first min-heap.

[0010] In the preferred embodiment of the present application, the step of managing the garbage collection operation of the superblock through the first min-heap and the second min-heap comprises: retrieving the target first sub-superblock from the first min-heap when a preset garbage collection condition of the superblock is detected; performing a garbage collection operation on the target first sub-superblock based on a preset garbage collection operation instruction to obtain a garbage-collected target first sub-superblock; and placing the garbage-collected target first sub-superblock in the second min-heap.

[0011] In the preferred embodiment of the present application, after the step of retrieving the target first sub-superblock from the first min-heap, the method comprises: placing a target fourth sub-superblock with the least amount of available resources in the first data structure at the head of the first min-heap.

[0012] In the preferred embodiment of the present application, the step of placing the garbage-collected target first sub-superblock in the second min-heap comprises: performing a min-heap push operation to place the garbage-collected target first sub-superblock in the second min-heap.

[0013] In the second aspect, an embodiment of the present application provides a superblock management method, comprising: a target storage block acquisition module configured to acquire a target storage block in a storage unit in a plurality of NandFlash; the target storage blocks have the same block number; a min-heap container initialization module configured to initialize a min-heap container; a superblock construction module configured to construct a superblock according to the target storage block; a data structure writing module configured to write a first data structure of a first sub-superblock full of data in the superblock into a first min-heap in the min-heap container, and write a second data structure of a second sub-superblock not full of data in the superblock into a second min-heap in the min-heap container; and a management module configured to manage a write operation and a garbage collection operation of the superblock through the first min-heap and the second min-heap.

[0014] In a third aspect, the embodiments of the present application further provide an electronic device, which comprises a processor and a memory, the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the super block management method.

[0015] The embodiments of the present application have the following beneficial technical effects:

[0016] The embodiments of the present application provide a super block management method, device and electronic device, comprising: obtaining a target storage block in a storage unit in a plurality of NandFlash; the block numbers of the target storage blocks are the same; initializing a minimum heap container; constructing a super block according to the target storage blocks; writing a first data structure of a first sub-super block in the super block in a full data state into a first minimum heap in the minimum heap container; and writing a second data structure of a second sub-super block in the super block in an unwritten data state into a second minimum heap in the minimum heap container; managing the write operation and the garbage collection operation of the super block through the first minimum heap and the second minimum heap. The method manages and optimizes the super block write and garbage collection operation in the plurality of NandFlash through the minimum heap container, and improves the garbage collection and wear leveling algorithm efficiency of the SSD firmware. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0018] Figure 1 A flowchart of a super block management method provided by the embodiments of the present application is shown in the figure.

[0019] Figure 2 A flowchart of another super block management method provided by the embodiments of the present application is shown in the figure.

[0020] Figure 3 A structural diagram of a super block management device provided by the embodiments of the present application is shown in the figure.

[0021] Figure 4 A structural diagram of an electronic device provided by the embodiments of the present application is shown in the figure.

[0022] Icons: 31-Storage block acquisition module; 32-Minimum heap container initialization module; 33-Superblock construction module; 34-Data structure writing module; 35-Management module; 41-Memory; 42-Processor; 43-Bus; 44-Communication interface. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0024] Currently, the technical challenges of improving the efficiency of garbage collection and wear leveling algorithms in SSD firmware urgently need to be addressed.

[0025] Based on this, embodiments of the present invention provide a superblock management method, apparatus, and electronic device. This method improves the efficiency of SSD firmware's garbage collection and wear leveling algorithms by managing and optimizing superblock write and garbage collection operations in multiple NandFlash memory locations using a minimum heap container. For ease of understanding, a superblock management method will first be described in detail.

[0026] Example 1

[0027] In this embodiment, Figure 1 This is a flowchart illustrating a superblock management method provided in an embodiment of the present invention.

[0028] Depend on Figure 1 As seen, the method includes:

[0029] Step S101: Obtain the target storage block from the storage cells in multiple NandFlash; the target storage blocks have the same block number.

[0030] Step S102: Initialize the min-heap container.

[0031] Step S103: Construct a superblock based on the target storage block described above.

[0032] In this embodiment, the data structure of the superblock includes: the block number, valid count, PE count, and superblock status.

[0033] Step S104: Write the first data structure of the first sub-superblock in the superblock that is in a state of being filled with data into the first min-heap in the min-heap container; and write the second data structure of the second sub-superblock in the superblock that is in a state of not being written with data into the second min-heap in the min-heap container.

[0034] wherein, the key of the first min-heap is the number of available resources of the first data structure; the min-heap head of the first min-heap is the target first sub-superblock with the smallest number of available resources in the first data structure; the key of the second min-heap is the number of erasures of the second data structure; the min-heap head of the second min-heap is the target second sub-superblock with the smallest number of erasures in the second data structure.

[0035] Step S105: managing the write operation and the garbage collection operation of the superblock through the first min-heap and the second min-heap.

[0036] The embodiment of the present application provides a superblock management method, comprising: obtaining target storage blocks in storage units in a plurality of NandFlash; the block numbers of the target storage blocks are the same; initializing a min-heap container; constructing a superblock according to the target storage blocks; writing a first data structure of a first sub-superblock in the superblock in a full-data state into a first min-heap in the min-heap container; and writing a second data structure of a second sub-superblock in the superblock in a no-data state into a second min-heap in the min-heap container; and managing the write operation and the garbage collection operation of the superblock through the first min-heap and the second min-heap. The method manages and optimizes the superblock write and garbage collection operation in the plurality of NandFlash through the min-heap container, and improves the garbage collection and wear leveling algorithm efficiency of the SSD firmware.

[0037] Embodiment 2

[0038] On the basis of the above embodiment, Figure 2 The flowchart of another superblock management method provided by the embodiment of the present application is shown.

[0039] According to the embodiment of the present application, Figure 2 The method comprises:

[0040] Step S201: obtaining target storage blocks in storage units in a plurality of NandFlash; the block numbers of the target storage blocks are the same.

[0041] Step S202: initializing a min-heap container.

[0042] Step S203: constructing a superblock according to the target storage blocks.

[0043] Step S204: writing a first data structure of a first sub-superblock in the superblock in a full-data state into a first min-heap in the min-heap container; and writing a second data structure of a second sub-superblock in the superblock in a no-data state into a second min-heap in the min-heap container.

[0044] Step S205: When receiving the write command, the target second sub-superblock is fetched from the second min-heap.

[0045] Step S206: According to the write command, the write operation is performed on the target second sub-superblock until the target second sub-superblock is full, obtaining a full-data target second sub-superblock.

[0046] Step S207: The full-data target second sub-superblock is placed into the first min-heap.

[0047] In this embodiment, after the step of fetching the target second sub-superblock from the second min-heap, the method further includes: placing a target third sub-superblock with the minimum number of erasures in the second data structure into the min-heap head of the second min-heap.

[0048] Further, the step of placing the full-data target second sub-superblock into the first min-heap includes: performing a min-heap push operation to place the full-data target second sub-superblock into the first min-heap.

[0049] Further, after the step S204, the method further includes: managing the garbage collection operation of the superblocks through the first min-heap and the second min-heap.

[0050] Further, the step of managing the garbage collection operation of the superblocks through the first min-heap and the second min-heap includes: fetching the target first sub-superblock from the first min-heap when it is detected that the superblock reaches a preset garbage collection condition; performing a garbage collection operation on the target first sub-superblock based on a preset garbage collection operation instruction, obtaining a garbage-collected target first sub-superblock; and placing the garbage-collected target first sub-superblock into the second min-heap.

[0051] Further, after the step of fetching the target first sub-superblock from the first min-heap, the method further includes: placing a target fourth sub-superblock with the minimum number of available resources in the first data structure into the min-heap head of the first min-heap.

[0052] Further, the step of placing the garbage-collected target first sub-superblock into the second min-heap includes: performing a min-heap push operation to place the garbage-collected target first sub-superblock into the second min-heap.

[0053] The embodiment of the present application provides a super block management method, comprising: obtaining a target storage block in a storage unit in a plurality of NandFlash; the block numbers of the target storage blocks are same; initializing a minimum heap container; constructing a super block according to the target storage blocks; writing a first data structure of a first sub-super block in the super block in a full data state into a first minimum heap in the minimum heap container; and writing a second data structure of a second sub-super block in the super block in an unwritten data state into a second minimum heap in the minimum heap container; when a write command is received, calling the target second sub-super block from the second minimum heap; performing a write operation on the target second sub-super block according to the write command until the target second sub-super block is full, so as to obtain a full data target second sub-super block; and putting the full data target second sub-super block into the first minimum heap. The method manages and optimizes the super block write operation in the plurality of NandFlash through the minimum heap container, and improves the garbage collection and wear leveling algorithm efficiency of the SSD firmware.

[0054] Embodiment 3

[0055] On the basis of the above-mentioned embodiments, Figure 3 A structural schematic diagram of a super block management device provided by the embodiment of the present application is provided.

[0056] As seen from Figure 3 The device comprises:

[0057] A storage block obtaining module 31 is configured to obtain a target storage block in a storage unit in a plurality of NandFlash; the block numbers of the target storage blocks are same.

[0058] A minimum heap container initializing module 32 is configured to initialize a minimum heap container.

[0059] A super block constructing module 33 is configured to construct a super block according to the target storage blocks.

[0060] A data structure writing module 34 is configured to write a first data structure of a first sub-super block in the super block in a full data state into a first minimum heap in the minimum heap container; and write a second data structure of a second sub-super block in the super block in an unwritten data state into a second minimum heap in the minimum heap container.

[0061] A management module 35 is configured to manage the write operation and the garbage collection operation of the super block through the first minimum heap and the second minimum heap.

[0062] The storage block obtaining module 31, the minimum heap container initializing module 32, the super block constructing module 33, the data structure writing module 34 and the management module 35 are sequentially connected.

[0063] In one of the embodiments, the management module 35 is further configured to, when a write command is received, retrieve the target second sub-superblock from the second min-heap; perform a write operation on the target second sub-superblock according to the write command until the target second sub-superblock is full, obtaining a full-data target second sub-superblock; and place the full-data target second sub-superblock into the first min-heap.

[0064] In one of the embodiments, the management module 35 is further configured to place a target third sub-superblock with the least number of erasures in the second data structure at the head of the second min-heap.

[0065] In one of the embodiments, the management module 35 is further configured to perform a min-heap push operation to place the full-data target second sub-superblock into the first min-heap.

[0066] In one of the embodiments, the management module 35 is further configured to, when it is detected that the superblock meets a preset garbage collection condition, retrieve the target first sub-superblock from the first min-heap; perform a garbage collection operation on the target first sub-superblock based on a preset garbage collection operation instruction, obtaining a garbage-collected target first sub-superblock; and place the garbage-collected target first sub-superblock into the second min-heap.

[0067] In one of the embodiments, the management module 35 is further configured to, after the step of retrieving the target first sub-superblock from the first min-heap, place a target fourth sub-superblock with the least amount of available resources in the first data structure at the head of the first min-heap.

[0068] In one of the embodiments, the management module 35 is further configured to perform a min-heap push operation to place the garbage-collected target first sub-superblock into the second min-heap.

[0069] The superblock management apparatus provided by the embodiments has the same technical features as the superblock management method provided by the embodiments, and can solve the same technical problems and achieve the same technical effects. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the apparatus described above can refer to the corresponding process in the foregoing method embodiments, which will not be described herein.

[0070] Embodiment 4

[0071] The embodiment provides an electronic device, comprising a processor and a memory, the memory storing computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement steps of the super block management method.

[0072] The embodiment provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement steps of the super block management method.

[0073] Referring to Figure 4 A structural schematic diagram of an electronic device is shown, and the electronic device comprises a memory 41 and a processor 42, the memory 41 stores a computer program capable of running on the processor 42, and the processor implements steps provided by the super block management method when executing the computer program.

[0074] As Figure 4 shown, the device further comprises a bus 43 and a communication interface 44, the processor 42, the communication interface 44 and the memory 41 are connected through the bus 43, and the processor 42 is used for executing executable modules stored in the memory 41, such as a computer program.

[0075] The memory 41 can include a high-speed random access memory (RAM, Random Access Memory) and can also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 44 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network and the like can be used.

[0076] The bus 43 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 4 only one bidirectional arrow is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0077] The memory 41 is configured to store a program, and the processor 42 is configured to execute the program after receiving an execution instruction. The method performed by the super block management apparatus according to any one of the embodiments of the present application can be applied to the processor 42 or implemented by the processor 42. The processor 42 can be an integrated circuit chip with a processing capability of signals. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 42 or an instruction in the form of software. The processor 42 can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; or a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Each method, step and logic block diagram disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory 41, and the processor 42 reads the information in the memory 41 and combines the hardware to complete the steps of the above method.

[0078] Further, the embodiment of the present application further provides a machine readable storage medium, the machine readable storage medium stores machine executable instructions, when the machine executable instructions are called and executed by the processor 42, the machine executable instructions cause the processor 42 to implement the super block management method.

[0079] The electronic device and the computer readable storage medium provided by the embodiments of the present application have the same technical features, so they can also solve the same technical problems and achieve the same technical effects.

[0080] In addition, in the description of the embodiments of the present application, unless specifically defined and limited, the terms "mounting", "connection", "connecting" should be understood in a broad sense, for example, can be fixedly connected, can also be detachably connected, or integrally connected; can be mechanically connected, can also be electrically connected; can be directly connected, can also be indirectly connected through an intermediate medium, can be internal communication of two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.

[0081] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", "third" are only for the purpose of description, and cannot be understood as indicating or implying relative importance.

Claims

1. A superblock management method, characterized in that, include: Obtain target storage blocks from multiple storage cells in NandFlash; the target storage blocks have the same block number; Initialize a min-heap container; Construct a superblock based on the target storage block; Write the first data structure of the first sub-superblock in the superblock that is in a state of being filled with data into the first min-heap of the min-heap container; and write the second data structure of the second sub-superblock in the superblock that is in a state of not being written with data into the second min-heap of the min-heap container; the key of the first min-heap is the number of available resources of the first data structure; the min-heap head of the first min-heap is the target first sub-superblock in the first data structure with the smallest number of available resources; the key of the second min-heap is the number of erases of the second data structure; the min-heap head of the second min-heap is the target second sub-superblock in the second data structure with the smallest number of erases; When a write command is received, the target second sub-superblock is retrieved from the second min-heap; According to the write command, a write operation is performed on the target second sub-superblock until the target second sub-superblock is full, resulting in a target second sub-superblock filled with data. Place the target second sub-superblock filled with data into the first min-heap; When the superblock is detected to have reached the preset garbage collection conditions, the target first sub-superblock is retrieved from the first min-heap; Based on the preset garbage collection operation instructions, a garbage collection operation is performed on the target first sub-superblock to obtain the garbage-collected target first sub-superblock; The target first sub-superblock after garbage collection is placed into the second min-heap.

2. The superblock management method according to claim 1, characterized in that, After the step of retrieving the target second sub-superblock from the second min-heap, the method includes: Place the target third sub-superblock with the fewest erase counts in the second data structure into the min-heap head of the second min-heap.

3. The superblock management method according to claim 1, characterized in that, The step of placing the target second sub-superblock filled with data into the first min-heap includes: Run the min-heap push operation to put the target second sub-superblock filled with data into the first min-heap.

4. The superblock management method according to claim 1, characterized in that, After the step of retrieving the target first sub-superblock from the first min-heap, the method includes: The fourth sub-superblock with the smallest number of available resources in the first data structure is placed at the head of the min-heap of the first min-heap.

5. The superblock management method according to claim 4, characterized in that, The step of placing the target first sub-superblock after garbage collection into the second min-heap includes: Run the min-heap push operation to put the target first sub-superblock after garbage collection into the second min-heap.

6. A superblock management method, characterized in that, include: A storage block acquisition module is used to acquire target storage blocks from multiple storage cells in NandFlash; the target storage blocks have the same block number. The min-heap container initialization module is used to initialize the min-heap container; A superblock construction module is used to construct a superblock based on the target storage block; A data structure writing module is used to write the first data structure of the first sub-superblock in the superblock that is in a state of being full of data into the first min-heap in the min-heap container; and to write the second data structure of the second sub-superblock in the superblock that is in a state of not being written to data into the second min-heap in the min-heap container; the key of the first min-heap is the number of available resources of the first data structure; the min-heap head of the first min-heap is the target first sub-superblock in the first data structure with the smallest number of available resources; the key of the second min-heap is the number of erases of the second data structure; the min-heap head of the second min-heap is the target second sub-superblock in the second data structure with the smallest number of erases; The management module is used to retrieve the target second sub-superblock from the second min-heap when a write command is received; According to the write command, a write operation is performed on the target second sub-superblock until the target second sub-superblock is full, resulting in a target second sub-superblock filled with data; the target second sub-superblock filled with data is placed into the first min-heap; when the superblock is detected to have reached a preset garbage collection condition, the target first sub-superblock is retrieved from the first min-heap; based on a preset garbage collection operation instruction, a garbage collection operation is performed on the target first sub-superblock, resulting in a garbage-collected target first sub-superblock; the garbage-collected target first sub-superblock is placed into the second min-heap.

7. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the superblock management method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for realizing data processing, computer storage medium and terminal

    CN113608702A

  • Garbage recycling method and device for solid state disk, electronic equipment and storage medium

    CN115756341A