Storage block virtual binding method and device, chip and storage medium
By searching for non-empty memory blocks in the memory chip and performing virtual binding, the problem of write speed reduction caused by traditional binding algorithms in the hybrid binding area is solved, and the read and write performance of the memory chip and the utilization rate of the memory chip are improved.
Patent Information
- Application Number
- CN202411999396.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Traditional memory chip binding algorithms cause the problem of decreasing writing speed in the hybrid binding area, especially after the memory chip capacity increases.
By searching for non-empty memory blocks in the target memory chip, and sending the searched non-empty memory blocks to the source block queue in preset time order; obtaining the preset number of virtual bindings; obtaining non-empty and empty memory blocks from the storage surfaces of the source block queue and the memory chip according to the preset rules, and writing data through the page register to realize virtual binding of the memory block.
The read and write performance of the memory chip and the utilization rate of the memory capacity are improved, and the problem of decreasing write speed is avoided.
Smart Images

Figure CN119806422A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of chip control technology, and in particular to a storage block virtual binding method, device, chip and storage medium. Background Art
[0002] In the field of memory chips, the Flash Translation Layer (FTL) plays a crucial role, and its binding algorithm is a key factor affecting storage performance, reliability, and resource utilization. Traditional binding algorithms include virtual binding and hybrid binding. Sequential binding binds physically contiguous blocks in a memory chip as a larger storage block. For example, in a NAND Flash chip, consecutive physical blocks are grouped together sequentially, starting from the starting address. This binding method creates a neat linear structure for data storage. Hybrid binding combines sequentially discontinuous blocks into a larger storage unit, breaking the constraints of physical order and combining dispersed blocks according to specific rules. However, traditional binding algorithms can only perform internal copyback operations on sequentially bound storage blocks. Hybridly bound storage blocks, because they are not sequentially bound, cannot serve as the destination of internal copyback operations. Furthermore, traditional binding algorithms lead to an increase in the number of storage blocks in the hybrid binding area. Consequently, as the storage chip capacity increases, more storage blocks are placed in the hybrid binding area, which in turn leads to a decrease in write speed as the storage chip capacity increases. Summary of the Invention
[0003] Embodiments of the present invention provide a storage block virtual binding method, device, computer equipment, and storage medium method and device, which can improve the read and write performance and full capacity of storage chips.
[0004] In a first aspect, an embodiment of the present application provides a method for virtual binding of storage blocks, comprising: searching for non-empty storage blocks in a target storage chip, and sending the searched non-empty storage blocks to a source block queue in a preset time sequence; obtaining a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the quantity of storage surfaces of the target storage chip; obtaining the non-empty storage blocks of the virtual binding quantity from the source block queue as blocks to be bound according to a preset first rule; obtaining the empty storage blocks of the virtual binding quantity from the storage surface of the target storage chip as destination blocks according to a preset second rule; and writing page data of the block to be bound to the destination block through a page register to obtain a virtual binding result of the storage block.
[0005] Optionally, the step of obtaining the virtually bound number of non-empty storage blocks as blocks to be bound from the source block queue according to a preset first rule includes: traversing the source block queue for the first time in chronological order to obtain the amount of stored data and storage surface numbers of the non-empty storage blocks in the source block queue; obtaining the virtually bound number of non-empty storage blocks as blocks to be bound based on the stored data amount and the storage surface numbers, wherein the storage surface numbers of all the blocks to be bound are the same.
[0006] Optionally, the step of obtaining the virtual binding quantity of non-empty storage blocks as the blocks to be bound based on the stored data volume and the storage surface number includes: judging whether the stored data volume of the non-empty storage block currently traversed by the first pass is greater than a preset storage data volume threshold; if it is greater than the preset storage data volume threshold, obtaining the non-empty storage block currently traversed by the first pass as the first temporary storage block, and setting the storage surface number of the first temporary storage block as the first surface number; pausing the first traversal, and performing a second traversal from the next non-empty storage block of the first temporary storage block, obtaining a non-empty storage block with a storage surface number equal to the first surface number and a stored data volume greater than the preset storage data volume threshold as the second temporary storage block; when the number of the second temporary storage blocks obtained is equal to the virtual binding quantity minus 1, stopping the second traversal and the first traversal, and setting the first temporary block and the second temporary block as the blocks to be bound.
[0007] Optionally, after the step of obtaining a non-empty storage block whose storage surface number is equal to the first surface number and whose stored data volume is greater than the preset storage data volume threshold as the second temporary storage block, it also includes: if at the end of the second traversal, the number of the second temporary blocks obtained is less than the virtual binding number minus 1, restarting the first traversal; repeating the steps of determining whether the stored data volume of the non-empty storage block currently traversed by the first traversal is greater than the preset storage data volume threshold to setting the first temporary block and the second temporary block as the blocks to be bound.
[0008] Optionally, the step of obtaining the virtual binding number of empty storage blocks from the storage plane of the target storage chip according to a preset second rule includes: calculating the number of empty storage blocks in each storage plane of the target storage chip; obtaining an empty storage block from different storage planes in order of the number of empty blocks from largest to smallest, wherein the number of the obtained empty storage blocks is equal to the virtual binding number.
[0009] Optionally, after the step of obtaining an empty storage block from different storage planes in descending order of the number of empty blocks, the method further includes: if the number of the obtained empty storage blocks is less than the virtual binding number, subtracting 1 from the virtual binding number to obtain a second virtual binding number, and updating the virtual binding number using the second virtual binding number; and using the updated virtual binding number to execute the steps of calculating the number of empty storage blocks in each storage plane of the target storage chip until the number of the obtained empty storage blocks is equal to the virtual binding number.
[0010] Optionally, after the step of writing the page data of the block to be bound to the target block through the page register to obtain the virtual binding result of the storage block, it also includes: clearing the data of the block to be bound to obtain a new empty storage block; and re-executing the step of calculating the number of empty storage blocks in each storage plane of the target storage chip.
[0011] In a second aspect, an embodiment of the present application provides a storage block virtual binding device, comprising: a source block queue module, used to search for non-empty storage blocks in a target storage chip, and send the searched non-empty storage blocks to a source block queue in chronological order; a virtual binding quantity module, used to obtain a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the quantity of storage surfaces of the target storage chip; a first block acquisition module, used to obtain the non-empty storage blocks of the virtual binding quantity as blocks to be bound from the source block queue according to a preset first rule; a second block acquisition module, used to obtain the empty storage blocks of the virtual binding quantity as destination blocks from the storage surface of the target storage chip according to a preset second rule; and a virtual binding execution module, used to write the page data of the block to be bound to the destination block through a page register to obtain a storage block virtual binding result.
[0012] In a third aspect, an embodiment of the present application provides a chip, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the steps of the storage block virtual binding method as described above when executing the program stored in the memory.
[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the storage block virtual binding method described above when executed by a processor.
[0014] Embodiments of the present application provide a storage block virtual binding method, apparatus, computer device, and storage medium, which searches for non-empty storage blocks in a target storage chip and sends the searched non-empty storage blocks to a source block queue in a preset time sequence; obtains a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the quantity of storage planes of the target storage chip; obtains the non-empty storage blocks of the virtual binding quantity from the source block queue as blocks to be bound according to a preset first rule; obtains the empty storage blocks of the virtual binding quantity from the storage plane of the target storage chip as destination blocks according to a preset second rule; writes page data of the blocks to be bound to the destination block through a page register to obtain a storage block virtual binding result; in this way, the read and write performance and full capacity rate of the storage chip are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1 This is a schematic diagram of the application environment of a storage block virtual binding method provided by the present application.
[0017] Figure 2 It is a schematic diagram of the execution flow of the storage block virtual binding method provided in an embodiment of the present application.
[0018] Figure 3 It is a flowchart of obtaining a block to be bound according to a preset first rule in the storage block virtual binding method provided in an embodiment of the present application.
[0019] Figure 4 It is a flowchart of obtaining a non-empty storage block as a block to be bound in the storage block virtual binding method provided in an embodiment of the present application.
[0020] Figure 5 This is a flow chart of the second pass of the storage block virtual binding method provided in an embodiment of the present application.
[0021] Figure 6 It is a flowchart of obtaining an empty storage block in the storage block virtual binding method provided in an embodiment of the present application.
[0022] Figure 7 It is a flowchart of updating the virtual binding quantity in the storage block virtual binding method provided in an embodiment of the present application.
[0023] Figure 8This is an example diagram of obtaining an empty storage block in the storage block virtual binding method provided in an embodiment of the present application.
[0024] Figure 9 Schematic diagram of the system structure of the storage block virtual binding device provided in an embodiment of the present application.
[0025] Figure 10 This is a schematic structural diagram of a chip according to an embodiment of the present application.
[0026] Figure 11 This is a schematic diagram of the structure of a computer-readable storage medium according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] The embodiments of the present application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application and are not to be construed as limiting the present application.
[0028] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0029] In the embodiments of the present application, it should be noted that, in this document, relational terms such as first and second, etc., are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0030] Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0031] In the description of the embodiments of this application, words such as "example" or "for example" are used to indicate an example, illustration, or description. Any embodiment or design described as "for example" or "for example" in the embodiments of this application is not to be construed as being preferred or having more advantages than another embodiment or design. The use of words such as "example" or "for example" is intended to clearly present relative concepts.
[0032] In addition, in the embodiments of the present application, "plurality" refers to two or more. In view of this, in the embodiments of the present application, "plurality" can also be understood as "at least two". "At least one" can be understood as one or more, for example, one, two, or more. For example, "including at least one" means including one, two, or more, and does not limit which ones are included. For example, "including at least one of A, B, and C" means including A, B, C, A and B, A and C, B and C, or A, B, and C.
[0033] See also Figure 1 , Figure 1 This is a schematic diagram of an application environment of a storage block virtual binding method provided by the present application. Figure 1 As shown, the execution subject of the storage block virtual binding method provided in the embodiment of the present application is generally a chip with a certain storage capacity, such as a NAND Flash storage chip. In some possible implementations, the storage block virtual binding method can be implemented by a processor calling a computer-readable instruction stored in a memory. Among them, it can be understood that Figure 1 The number of chips is only for reference and can be expanded to any number according to actual needs.
[0034] An embodiment of the present application provides a storage block virtual binding method, Figure 2 It is a schematic diagram of the execution flow of the storage block virtual binding method provided in the embodiment of the present application. This specification provides method operation steps such as the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual system or server product is executed, it can be executed in sequence or in parallel according to the method shown in the embodiment or the accompanying drawings (for example, in a parallel processor or multi-threaded processing environment). Specifically, Figure 2 As shown, the storage block virtual binding method may include the following steps S1 to S5.
[0035] S1. Search for non-empty memory blocks in the target memory chip, and send the searched non-empty memory blocks to the source block queue in a preset time sequence.
[0036] Memory chips (using NAND Flash as an example) are composed of multiple memory cells, organized into structures such as blocks and pages. A memory block typically contains multiple pages, and data read and write operations are often performed on a page basis, while erase operations are performed on a block basis. A non-empty memory block is one in which at least one page stores valid data. During the lifecycle of a memory chip, the state of a memory block constantly changes due to operations such as data writes and erases. Some blocks may be fully filled, others partially filled, or still others may be erased to empty.
[0037] S2. Obtain a preset virtual binding quantity, where the virtual binding quantity is less than or equal to the quantity of storage planes of the target storage chip.
[0038] In memory chips (such as NAND Flash chips), the plane (storage surface) is a key component of the chip's internal physical structure and can be considered a two-dimensional data storage area within the chip. A memory chip typically contains multiple planes. These planes are physically independent but together constitute the entire memory chip's storage capacity. Taking three-dimensional NAND Flash as an example, each plane is composed of multiple memory cells arranged vertically and horizontally. From a cross-section of the chip, the planes resemble layers of "data layers." Each plane has its own independent circuit system for data read, write, and erase operations. This allows operations on multiple planes to be performed simultaneously, thereby improving the read and write efficiency of the memory chip. In the organizational structure of a memory chip, a plane contains multiple blocks, which in turn contain multiple pages. A page is the smallest unit of data read and write, while a block is the smallest unit of data erase operations. For example, in NAND Flash, a plane may contain thousands of blocks, each of which may contain dozens to hundreds of pages. Data is stored in the memory chip from plane to block to page.
[0039] S3. Obtain a virtual binding quantity of non-empty storage blocks from the source block queue as blocks to be bound according to a preset first rule.
[0040] Please continue reading Figure 3 , Figure 3 FIG. 1 is a flow chart of obtaining a block to be bound according to a preset first rule in a storage block virtual binding method provided by an embodiment of the present application, such as Figure 3 As shown, the process includes the following steps S31 to S32.
[0041] S31 , traverse the source block queue for the first time in chronological order, and obtain the amount of stored data and storage surface numbers of non-empty storage blocks in the source block queue.
[0042] S32 , obtaining a virtual binding quantity of non-empty storage blocks as blocks to be bound according to the amount of stored data and the storage plane numbers, wherein the storage plane numbers of all the blocks to be bound are the same.
[0043] Among them, it should be noted that after obtaining the non-empty storage block, the non-empty storage block can also be detected as a bad block. If the obtained non-empty storage block is a bad block, the non-empty storage block detected as a bad block will not perform the virtual binding operation, and the non-empty storage block will be sent to the bad block processing module.
[0044] Please continue reading Figure 4 , Figure 4 FIG. 1 is a flow chart of obtaining a non-empty storage block as a block to be bound in the storage block virtual binding method provided in an embodiment of the present application, such as Figure 4 As shown, the process includes the following steps S321 to S324.
[0045] S321: Determine whether the amount of stored data in the non-empty storage block currently traversed for the first time is greater than a preset storage data amount threshold.
[0046] Among them, setting a data volume threshold can help allocate storage blocks more efficiently. The storage blocks of memory chips may have the same size, but the data storage needs are diverse. By setting a threshold, for example, stipulating that a storage block can store a maximum of 80% of the data volume, it is possible to avoid a situation where a certain storage block is overfilled while other storage blocks are idle. On the other hand, it helps to balance the utilization of storage resources so that each storage block can be used within a reasonable range, thereby improving the overall storage efficiency of the memory chip.
[0047] S322: If the amount of stored data is greater than a preset threshold, obtain a non-empty storage block currently being traversed for the first time as a first temporary storage block, and set the storage surface number of the first temporary storage block as the first surface number.
[0048] S323. Pause the first traversal and perform a second traversal from the next non-empty storage block of the first temporary storage block, and obtain a non-empty storage block whose storage surface number is equal to the first surface number and whose stored data volume is greater than a preset storage data volume threshold as the second temporary storage block.
[0049] Among them, in step S323, all the storage blocks with the same storage plane number are obtained. On the one hand, different planes usually have similar storage capacity and performance characteristics. When the storage block in a plane is almost full, its part of the content is distributed to other planes. This can better utilize the remaining space of other planes, help improve the overall storage efficiency of the memory chip, and avoid wasting space in a certain plane. On the other hand, multiple planes of the memory chip have the ability to operate in parallel, such as writing or reading data at the same time. After distributing the nearly full storage blocks to different planes, this parallelism can be better utilized in subsequent data operations. For example, when it is necessary to read or update the data in these storage blocks that were once almost full, because they are distributed in different planes, multiple planes can operate simultaneously, thereby speeding up data processing and improving the performance of the storage system.
[0050] S324 : When the number of the acquired second temporary storage blocks is equal to the virtual binding number minus 1, stop the second traversal and the first traversal, and set the first temporary block and the second temporary block as blocks to be bound.
[0051] Please continue reading Figure 5 , Figure 5 This is a flow chart of the second pass of the storage block virtual binding method provided in the embodiment of the present application after the end of the traversal. Figure 5 As shown, it includes the following steps S325 to S326.
[0052] S325: If, at the end of the second traversal, the number of acquired second temporary blocks is less than the number of virtual bindings minus 1, restart the first traversal.
[0053] When the number of non-empty storage blocks that meet the above-mentioned block data volume screening condition in the current storage plane is less than the virtual binding quantity, other storage planes (Plane) are continuously detected.
[0054] S326 , repeatedly executing the steps from determining whether the amount of stored data in the non-empty storage block currently traversed by the first pass is greater than the preset storage data amount threshold to setting the first temporary block and the second temporary block as the blocks to be bound.
[0055] It should be noted that, when the number of detected non-empty memory blocks does not meet the above-mentioned execution conditions for executing virtual binding, the subsequent virtual binding steps may be temporarily not executed, and the above-mentioned virtual binding steps may be re-executed when the non-empty memory blocks of the target chip meet the above-mentioned execution conditions for executing virtual binding.
[0056] S4. Obtain a virtual binding quantity of empty storage blocks from the storage plane of the target storage chip as destination blocks according to a preset second rule.
[0057] Please continue reading Figure 6 , Figure 6 FIG. 1 is a flow chart of obtaining an empty storage block in the storage block virtual binding method provided in an embodiment of the present application, such as Figure 6 As shown, the process includes the following steps S41 to S42.
[0058] S41. Calculate the number of empty memory blocks in each memory plane of the target memory chip.
[0059] S42. Acquire an empty storage block from different storage planes in descending order of the number of empty blocks, wherein the number of acquired empty storage blocks is equal to the number of virtual bindings.
[0060] Retrieving free memory blocks from the plane with the most free blocks first, similar to prioritizing warehouses with abundant resources during resource allocation, ensures the most efficient use of storage resources within the memory chip. Failure to follow this approach may result in some planes' free memory blocks remaining idle while others fill up prematurely, reducing overall storage efficiency. For example, in a NAND Flash chip with multiple storage planes, suppose Plane A has a large number of free memory blocks, while other planes have fewer. By retrieving free memory blocks from the plane with the most free blocks first, Plane A's space can be fully utilized, avoiding occupying memory blocks from other planes when space is limited. Furthermore, data read and write operations within the same plane are generally faster than cross-plane operations because the data paths and control circuitry within the same plane are relatively simple, resulting in less data transmission latency. By retrieving free memory blocks from the plane with the most free blocks first, more data can be stored within the same plane, fully utilizing the fast read and write capabilities within the planes. For example, when continuously reading data, if the data is mainly stored in one Plane, it can be quickly read through the high-speed data channel of the Plane without the need to frequently switch between different Planes, thereby improving the reading speed.
[0061] Please continue reading Figure 7 , Figure 7 FIG. 1 is a flow chart of updating the virtual binding quantity in the storage block virtual binding method provided in an embodiment of the present application. Figure 7 As shown, the process includes the following steps S43 to S44.
[0062] S43: If the number of the obtained empty storage blocks is less than the virtual binding number, subtract 1 from the virtual binding number to obtain a second virtual binding number, and use the second virtual binding number to update the virtual binding number.
[0063] S44 , using the updated virtual binding number, execute steps from calculating the number of empty memory blocks in each memory plane of the target memory chip to obtaining a number of empty memory blocks that is equal to the virtual binding number.
[0064] Among them, when the initial preset number of virtual bindings results in the inability to find a corresponding number of empty storage blocks of different storage planes (Plane) for virtual binding, the processing can also be downgraded. For example, the processing of virtual binding of 6 different storage planes (Plane) can be downgraded to virtual binding operations of 5, 4, 3, and 2 storage planes (Plane), which greatly enhances the flexibility of virtual binding of storage blocks and improves the read and write performance of the storage chip.
[0065] See also Figure 8 , Figure 8 This is an example diagram of obtaining an empty storage block in the storage block virtual binding method provided in the embodiment of the present application, such as Figure 8 As shown, the number of known storage planes is 6, and the above virtual binding number is set to 3. Then, according to the above steps, the empty storage blocks that can be obtained are 1P1, 1P3 and 1P5, which correspond to Plane1, Plane3 and Plane5 respectively.
[0066] S5. Write the page data of the block to be bound into the destination block through the page register to obtain a virtual binding result of the storage block.
[0067] As an optional implementation, after step S5, the data in the blocks to be bound can be cleared to obtain new empty storage blocks. Then, the step of calculating the number of empty storage blocks in each storage plane of the target memory chip is re-executed. That is, after a round of virtual binding is completed, the new empty storage blocks are recycled to obtain more empty storage blocks, thereby increasing the full capacity of the memory chip.
[0068] The embodiment of the present application provides a storage block virtual binding method, which searches for non-empty storage blocks in a target storage chip and sends the searched non-empty storage blocks to a source block queue in a preset time sequence; obtains a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the quantity of storage planes of the target storage chip; obtains the non-empty storage blocks of the virtual binding quantity from the source block queue as blocks to be bound according to a preset first rule; obtains the empty storage blocks of the virtual binding quantity from the storage plane of the target storage chip as destination blocks according to a preset second rule; writes page data of the blocks to be bound to the destination block through a page register to obtain a storage block virtual binding result; in this way, the read and write performance and full capacity rate of the storage chip are improved.
[0069] Please continue reading Figure 9An embodiment of the present application provides a storage block virtual binding device. Figure 9 Schematic diagram of the system structure of the storage block virtual binding device provided by the embodiment of the present application, such as Figure 9 As shown, the storage block virtual binding device 90 includes: a source block queue module 91, a virtual binding quantity module 92, a first block acquisition module 93, a second block acquisition module 94, and a virtual binding execution module 95. The source block queue module 91 is configured to search for non-empty storage blocks in the target storage chip and send the searched non-empty storage blocks to the source block queue in chronological order. The virtual binding quantity module 92 is configured to obtain a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the number of storage planes of the target storage chip. The first block acquisition module 93 is configured to obtain the non-empty storage blocks of the virtual binding quantity from the source block queue as the blocks to be bound according to a preset first rule. The second block acquisition module 94 is configured to obtain the empty storage blocks of the virtual binding quantity from the storage planes of the target storage chip as the destination blocks according to a preset second rule. The virtual binding execution module 95 is configured to write the page data of the blocks to be bound to the destination block via a page register to obtain the storage block virtual binding result.
[0070] As an embodiment, the first block acquisition module 93 is specifically used to traverse the source block queue for the first time in chronological order to obtain the amount of stored data and the storage surface number of the non-empty storage blocks in the source block queue; based on the amount of stored data and the storage surface number, obtain the virtual binding number of non-empty storage blocks as the blocks to be bound, wherein the storage surface numbers of all the blocks to be bound are the same.
[0071] As an embodiment, the first block acquisition module 93 is further specifically used to determine whether the amount of stored data in the non-empty storage block currently traversed by the first pass is greater than a preset storage data amount threshold; if it is greater than the preset storage data amount threshold, the non-empty storage block currently traversed by the first pass is obtained as the first temporary storage block, and the storage surface number of the first temporary storage block is set as the first surface number; the first traversal is paused, and a second traversal is performed from the next non-empty storage block of the first temporary storage block, and a non-empty storage block with a storage surface number equal to the first surface number and a stored data amount greater than the preset storage data amount threshold is obtained as the second temporary storage block; when the number of the second temporary storage blocks obtained is equal to the virtual binding number minus 1, the second traversal and the first traversal are stopped, and the first temporary block and the second temporary block are set as the blocks to be bound.
[0072] As an embodiment, the first block acquisition module 93 is specifically further used to restart the first traversal if, at the end of the second traversal, the number of the acquired second temporary blocks is less than the virtual binding number minus 1; and repeat the steps of determining whether the amount of stored data in the non-empty storage block currently traversed by the first traversal is greater than the preset storage data amount threshold to setting the first temporary block and the second temporary block as the blocks to be bound.
[0073] As an embodiment, the second block acquisition module 94 is specifically used to calculate the number of empty blocks in each storage plane of the target storage chip; obtain an empty storage block from different storage planes in the order of the number of empty blocks from large to small, wherein the number of the obtained empty storage blocks is equal to the virtual binding number.
[0074] As an embodiment, the second block acquisition module 94 is further specifically configured to, if the number of the acquired empty storage blocks is less than the virtual binding number, subtract 1 from the virtual binding number to obtain a second virtual binding number, and use the second virtual binding number to update the virtual binding number; and use the updated virtual binding number to execute the steps from calculating the number of empty storage blocks in each storage plane of the target storage chip to the step of obtaining the number of empty storage blocks equal to the virtual binding number.
[0075] As an embodiment, the second block acquisition module 94 is further configured to clear the data of the block to be bound to obtain a new empty storage block; and re-execute the step of calculating the number of empty storage blocks in each storage plane of the target storage chip.
[0076] An embodiment of the present application provides a chip. Figure 10 As shown, the chip 100 includes a processor 101, a communication interface 102, a memory 103 and a communication bus 104, wherein the processor 101, the communication interface 102 and the memory 103 communicate with each other via the communication bus 104; the memory 103 is used to store computer programs; the processor 101 is used to implement the steps of the above-mentioned storage block virtual binding method when executing the program stored in the memory 103.
[0077] The processor 101 may also be a CPU (Central Processing Unit). The processor 101 may also be an integrated circuit chip having signal processing capabilities. The processor 101 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The general-purpose processor may be a microprocessor or any conventional processor.
[0078] The memory 103 may be, for example, a read-only memory (ROM), and the processor 101 and the memory 103 are connected to each other via a communication bus 104 . The communication interface 102 is also connected to the communication bus 104 .
[0079] See Figure 11 , Figure 11 Schematic diagram of the structure of a computer-readable storage medium of an embodiment of the present application. The computer-readable storage medium 110 of the embodiment of the present application stores a computer program 111 that can implement all the above methods. The computer program 111 is a computer-executable instruction or a computer program, wherein the computer program 111 can be stored in the above-mentioned computer-readable storage medium in the form of a software product, and can include a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The computer-readable storage medium 110 can be a non-volatile storage medium or a volatile storage medium. The aforementioned computer-readable storage medium 110 can include: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or a terminal device such as a computer, a server, a mobile phone, or a tablet.
[0080] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0081] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. The above is only an implementation method of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields, is also included in the patent protection scope of the present application.
[0082] The above is only an implementation method of the present application. It should be pointed out that for ordinary technicians in this field, improvements can be made without departing from the creative concept of the present application, but these all fall within the scope of protection of the present application.
Claims
1. A storage block virtual binding method, characterized in that: The method comprises: Searching for non-empty storage blocks in the target storage chip, and sending the searched non-empty storage blocks to the source block queue in a preset time sequence; Acquire a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the quantity of storage planes of the target storage chip; Acquire the non-empty storage blocks of the virtual binding quantity from the source block queue as blocks to be bound according to a preset first rule; According to a preset second rule, obtaining the virtual binding number of empty storage blocks from the storage plane of the target storage chip as destination blocks; The page data of the block to be bound is written into the target block through the page register to obtain a storage block virtual binding result.
2. The storage block virtual binding method according to claim 1, characterized in that: The step of obtaining the non-empty storage blocks of the virtual binding quantity as blocks to be bound from the source block queue according to a preset first rule includes: Traversing the source block queue for the first time in chronological order to obtain the amount of stored data and storage surface numbers of non-empty storage blocks in the source block queue; According to the amount of stored data and the storage surface number, the virtually bound number of non-empty storage blocks is obtained as the blocks to be bound, wherein the storage surface numbers of all the blocks to be bound are the same.
3. The storage block virtual binding method according to claim 2, characterized in that: The step of acquiring the non-empty storage blocks of the virtual binding quantity as the blocks to be bound according to the amount of stored data and the storage surface number comprises: Determine whether the amount of stored data in the non-empty storage block currently being traversed for the first time is greater than a preset storage data amount threshold; If it is greater than the preset storage data amount threshold, obtaining a non-empty storage block currently being traversed by the first pass as a first temporary storage block, and setting the storage surface number of the first temporary storage block as the first surface number; The first traversal is paused, and a second traversal is performed from the next non-empty storage block of the first temporary storage block, and a non-empty storage block whose storage surface number is equal to the first surface number and whose stored data volume is greater than the preset storage data volume threshold is obtained as a second temporary storage block; When the number of the acquired second temporary storage blocks is equal to the virtual binding number minus 1, the second traversal and the first traversal are stopped, and the first temporary blocks and the second temporary blocks are set as the blocks to be bound.
4. The storage block virtual binding method according to claim 1, characterized in that: After the step of obtaining a non-empty storage block whose storage surface number is equal to the first surface number and whose stored data volume is greater than the preset storage data volume threshold as the second temporary storage block, the method further includes: If, at the end of the second traversal, the number of the second temporary blocks obtained is less than the number of virtual bindings minus 1, restarting the first traversal; Repeat the steps of determining whether the amount of stored data in the non-empty storage block currently traversed by the first pass is greater than a preset storage data amount threshold to setting the first temporary block and the second temporary block as the blocks to be bound.
5. The storage block virtual binding method according to claim 1, characterized in that: The step of obtaining the virtual binding quantity of empty storage blocks from the storage plane of the target storage chip according to the preset second rule includes: Calculating the number of empty blocks of empty storage blocks in each storage plane of the target storage chip; An empty storage block is obtained from different storage planes in the order of the number of empty blocks from large to small, wherein the number of the obtained empty storage blocks is equal to the virtual binding number.
6. The storage block virtual binding method according to claim 5, characterized in that: After the step of acquiring an empty storage block from different storage planes in the order of the number of empty blocks from large to small, the method further includes: If the number of the obtained empty storage blocks is less than the virtual binding number, subtract 1 from the virtual binding number to obtain a second virtual binding number, and use the second virtual binding number to update the virtual binding number; The steps between calculating the number of empty memory blocks in each memory plane of the target memory chip and obtaining the number of empty memory blocks equal to the virtual binding number are performed using the updated virtual binding number.
7. The storage block virtual binding method according to claim 5, characterized in that: After the step of writing the page data of the block to be bound into the target block through the page register to obtain the storage block virtual binding result, the method further includes: Clear the data of the block to be bound to obtain a new empty storage block; The step of calculating the number of empty memory blocks in each memory plane of the target memory chip is re-executed.
8. A storage block virtual binding device, characterized in that: include: A source block queue module is used to search for non-empty storage blocks in the target storage chip and send the searched non-empty storage blocks to the source block queue in chronological order; A virtual binding quantity module, used to obtain a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the quantity of storage planes of the target storage chip; A first block acquisition module, configured to acquire the non-empty storage blocks of the virtual binding quantity from the source block queue as blocks to be bound according to a preset first rule; A second block acquisition module, configured to acquire the virtual binding quantity of empty storage blocks from the storage plane of the target storage chip as destination blocks according to a preset second rule; The virtual binding execution module is used to write the page data of the block to be bound into the target block through the page register to obtain the storage block virtual binding result.
9. A chip, characterized in that: The device includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor is used to implement the steps of the storage block virtual binding method described in any one of claims 1 to 7 when executing a program stored in a memory.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the storage block virtual binding method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Data storage medium management method and system, terminal equipment and storage medium
CN112068777A
Bad block management method and control method of memory and memory system
CN114550797A
Flash memory block binding method and device, equipment and storage medium
CN115687171A
Memory system and constructing method of virtual block
US20140289453A1
Program running method for storage apparatus, and electronic device and readable storage apparatus
WO2023206605A1