Storage block virtual binding method and device, chip and storage medium
By virtually binding non-empty and empty storage blocks in the storage chip, the problems of reduced write speed and wasted resources caused by traditional binding algorithms are solved, achieving more efficient read and write performance and storage efficiency.
Patent Information
- Application Number
- CN202411999396.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Traditional storage block binding algorithms lead to an increase in the number of mixed-binding storage blocks, resulting in a decrease in write speed as the storage chip capacity increases, and mixed-binding blocks cannot be internally copied back.
By searching for non-empty memory blocks in the target memory chip, sending them to the source block queue in a preset time sequence, obtaining a number of non-empty memory blocks to be bound as blocks to be bound, and obtaining empty memory blocks from the memory plane as destination blocks according to preset rules, and writing the page data of the block to be bound to the destination block through the page register, a virtual binding of memory blocks is formed.
It improves the read/write performance and storage efficiency of memory chips, avoids waste of storage block resources, and enhances the overall performance of the storage system.
Smart Images

Figure CN119806422B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of chip control, and in particular to a storage block virtual binding method and device, a chip and a storage medium. BACKGROUND
[0002] In the field of storage chips, the Flash Translation Layer (FTL) plays a crucial role, and the binding algorithm is a key factor affecting the storage performance, reliability and resource utilization. The traditional binding algorithm includes two ways: virtual binding and hybrid binding. Sequential binding is to bind the blocks in the storage chip that are continuous in physical order as a larger storage block. For example, in a NAND Flash chip, the continuous physical blocks starting from the starting address are combined together in sequence. This binding method makes the data storage present a regular linear structure. Hybrid binding is to integrate the blocks that are not continuous in sequence to form a larger storage unit, breaking the limitation of physical order and combining the scattered blocks together through specific rules. However, on the one hand, the traditional binding algorithm can only perform internal CopyBack operations on sequentially bound storage blocks. Hybrid bound storage blocks cannot be used as destination blocks for internal CopyBack operations because they are not sequentially bound blocks. On the other hand, the traditional binding algorithm can increase the number of storage blocks in the hybrid binding area, which in turn can cause the hybrid binding area to be filled with more storage blocks as the storage chip capacity increases, thereby causing the problem of decreased write speed after the storage capacity of the storage chip increases. SUMMARY
[0003] The embodiments of the present application provide a storage block virtual binding method and device, a computer device and a storage medium method and device, which can improve the read-write performance and capacity utilization of the storage chip.
[0004] In a first aspect, the embodiments of the present application provide a storage block virtual binding method, which includes: 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 order; obtaining a preset virtual binding number, wherein the virtual binding number is less than or equal to the number of storage surfaces of the target storage chip; obtaining the virtual binding number of non-empty storage blocks from the source block queue as to-be-bound blocks according to a preset first rule; obtaining the virtual binding number of empty storage blocks from the storage surfaces of the target storage chip as destination blocks according to a preset second rule; and writing the page data of the to-be-bound blocks to the destination blocks through a page register to obtain a storage block virtual binding result.
[0005] Optionally, the step of obtaining the virtual binding number of non-empty storage blocks from the source block queue as the to-be-bound blocks according to the preset first rule comprises: first-order traversal of the source block queue in time sequence, obtaining the stored data amount and the storage surface number of the non-empty storage blocks in the source block queue; obtaining the virtual binding number of non-empty storage blocks as the to-be-bound blocks according to the stored data amount and the storage surface number, wherein the storage surface numbers of all the to-be-bound blocks are the same.
[0006] Optionally, the step of obtaining the virtual binding number of non-empty storage blocks as the to-be-bound blocks according to the stored data amount and the storage surface number comprises: judging whether the stored data amount of the non-empty storage block currently traversed by the first-order traversal is greater than a preset stored data amount threshold; if greater than the preset stored data amount threshold, obtaining the non-empty storage block currently traversed by the first-order traversal as a first temporary storage block, setting the storage surface number of the first temporary storage block as a first surface number; pausing the first-order traversal, performing second-order traversal from the next non-empty storage block of the first temporary storage block, obtaining a non-empty storage block with the storage surface number equal to the first surface number and the stored data amount greater than the preset stored data amount threshold as a second temporary storage block; when the number of the obtained second temporary storage blocks is equal to the virtual binding number minus 1, stopping the second-order traversal and the first-order traversal, and setting the first temporary block and the second temporary block as the to-be-bound blocks.
[0007] Optionally, after the step of obtaining a non-empty storage block with the storage surface number equal to the first surface number and the stored data amount greater than the preset stored data amount threshold as a second temporary storage block, the method further comprises: if the number of the obtained second temporary blocks is less than the virtual binding number minus 1 when the second-order traversal ends, restarting the first-order traversal; repeating the steps from judging whether the stored data amount of the non-empty storage block currently traversed by the first-order traversal is greater than a preset stored data amount threshold to setting the first temporary block and the second temporary block as the to-be-bound blocks.
[0008] Optionally, the step of obtaining the virtual binding number of empty storage blocks from the storage surface of the target storage chip according to the preset second rule comprises: calculating the number of empty blocks in each storage surface of the target storage chip; obtaining an empty storage block from different storage surfaces 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.
[0009] Optionally, after the step of obtaining an empty storage block from different storage surfaces according to the order from large to small of the empty block quantity, the method further comprises: if the obtained empty storage block quantity is less than the virtual binding quantity, then reducing 1 from the virtual binding quantity to obtain a second virtual binding quantity, updating the virtual binding quantity using the second virtual binding quantity; and using the updated virtual binding quantity to perform the step of calculating the empty block quantity of the empty storage block in each storage surface of the target storage chip until the obtained empty storage block quantity is equal to the virtual binding quantity.
[0010] Optionally, after the step of writing the page data of the to-be-bound block into the destination block through the page register to obtain a storage block virtual binding result, the method further comprises: emptying the data of the to-be-bound block to obtain a new empty storage block; and re-executing the step of calculating the empty block quantity of the empty storage block in each storage surface of the target storage chip.
[0011] In a second aspect, an embodiment of the present application provides a storage block virtual binding device, which comprises: a source block queue module configured to search non-empty storage blocks in a target storage chip and send the searched non-empty storage blocks to a source block queue in a time sequence; a virtual binding quantity module configured to obtain a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the number of storage surfaces of the target storage chip; a first block obtaining module configured to obtain the virtual binding quantity of the non-empty storage blocks from the source block queue as to-be-bound blocks according to a preset first rule; a second block obtaining module configured to obtain the virtual binding quantity of empty storage blocks from storage surfaces of the target storage chip as destination blocks according to a preset second rule; and a virtual binding execution module configured to write page data of the to-be-bound blocks into the destination blocks 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 comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus; the memory is configured to store a computer program; and the processor is configured to execute the program stored on the memory to implement the steps of the storage block virtual binding method.
[0013] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of the storage block virtual binding method.
[0014] The embodiment of the present application provides a storage block virtual binding method, device, computer equipment and storage medium, through searching non-empty storage blocks in a target storage chip, and sending the searched non-empty storage blocks to a source block queue according to a preset time sequence; a preset virtual binding quantity is acquired, wherein the virtual binding quantity is less than or equal to the number of storage surfaces of the target storage chip; the virtual binding quantity of non-empty storage blocks is acquired from the source block queue as to-be-bound blocks according to a preset first rule; the virtual binding quantity of empty storage blocks is acquired from the storage surfaces of the target storage chip as destination blocks according to a preset second rule; page data of the to-be-bound blocks is written into the destination blocks through a page register, and a storage block virtual binding result is obtained; in the above manner, the read-write performance and capacity of the storage chip are improved. BRIEF DESCRIPTION OF DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0016] Figure 1 It is an application environment schematic diagram of a storage block virtual binding method provided by the embodiment of the present application.
[0017] Figure 2 It is an execution flow schematic diagram of the storage block virtual binding method provided by the embodiment of the present application.
[0018] Figure 3 It is a flow schematic diagram of acquiring to-be-bound blocks according to a preset first rule in the storage block virtual binding method provided by the embodiment of the present application.
[0019] Figure 4 It is a flow schematic diagram of acquiring non-empty storage blocks as to-be-bound blocks in the storage block virtual binding method provided by the embodiment of the present application.
[0020] Figure 5 It is a flow schematic diagram after the second traversal ends in the storage block virtual binding method provided by the embodiment of the present application.
[0021] Figure 6 It is a flow schematic diagram of acquiring empty storage blocks in the storage block virtual binding method provided by the embodiment of the present application.
[0022] Figure 7 It is a flow schematic diagram of updating the virtual binding quantity in the storage block virtual binding method provided by the embodiment of the present application.
[0023] Figure 8is an example diagram of acquiring an empty storage block in a storage block virtual binding method provided by an embodiment of the present application.
[0024] Figure 9 is a system structure schematic diagram of a storage block virtual binding apparatus provided by an embodiment of the present application.
[0025] Figure 10 is a structure schematic diagram of a chip of an embodiment of the present application.
[0026] Figure 11 is a structure schematic diagram of a computer readable storage medium of an embodiment of the present application. DETAILED DESCRIPTION
[0027] The embodiments of the present application will be described in detail below with reference to the drawings, in which the same or similar components are denoted by the same reference numerals, and therefore repeated description is omitted. The embodiments described below are merely exemplary for explaining the present application, and should not be construed as limiting the present application.
[0028] In order to make the technical personnel in the art better understand the scheme of the present application, 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. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0029] In the embodiments of the present application, it should be noted that, in this document, relational terms such as first and second and the like are used solely to distinguish one entity or action from another entity or action, without necessarily requiring or implying any actual such relationship or order between or among the entities or actions.
[0030] Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or apparatus that comprises a list of elements does not include only those elements, but also other elements not expressly listed or other elements inherent in such process, method, article or apparatus. Without more limitations, an element defined by the phrase "comprising a" does not exclude the existence of additional identical elements in the process, method, article or apparatus that includes the element.
[0031] In the description of the embodiments of the present application, the words "example" or "for example" or similar words are used to represent that the embodiments described are examples, illustration, or description. Any embodiment or design scheme described as "example" or "for example" in the embodiments of the present application is not interpreted as more preferred or having more advantages than another embodiment or design scheme. The use of "example" or "for example" or similar words is intended to present the relative concept in a clear manner.
[0032] In addition, "multiple" in the embodiments of the present application refers to two or more, and therefore "multiple" in the embodiments of the present application 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, and the included can be A, B, C, A and B, A and C, B and C, or A and B and C.
[0033] Please refer to Figure 1 , Figure 1 is an application environment diagram of a storage block virtual binding method provided by the embodiments of the present application, as Figure 1 shown, the execution subject of the storage block virtual binding method provided by the embodiments of the present application is generally a chip with certain storage capacity, such as a NAND Flash storage chip, and in some possible implementation manners, the storage block virtual binding method can be realized by a processor calling computer readable instructions stored in a memory. It can be understood that Figure 1 the number of chips in the chip is only illustrative, and can be extended in any number according to actual needs.
[0034] An embodiment of the present application provides a storage block virtual binding method, Figure 2 is a flowchart diagram of the storage block virtual binding method provided by the embodiments of the present application, and the present specification provides method operation steps such as embodiments or flowcharts, but more or fewer operation steps can be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one of the many execution orders, and does not represent the only execution order. In actual system or server product execution, the method order shown in the embodiments or the drawing can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment). Specifically, as Figure 2 shown, the storage block virtual binding method can include the following steps S1 to S5.
[0035] S1, 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 a preset time sequence.
[0036] The storage chip (for example, a NAND Flash) is composed of a plurality of storage units, and the storage units are organized into structures such as blocks and pages. A storage block usually contains a plurality of pages, and the read and write operations of data are usually in units of pages, and the erase operation is in units of blocks. A non-empty storage block refers to a storage block in which at least one page stores valid data. In the life cycle of the storage chip, due to the writing, erasing and other operations of data, the state of the storage block will change continuously, some blocks may be filled with data, some blocks may be partially filled, and some blocks may be erased to be empty.
[0037] S2, a preset virtual binding number is obtained, wherein the virtual binding number is less than or equal to the number of storage surfaces of the target storage chip.
[0038] In the storage chip (for example, a NAND Flash chip), a Plane (storage surface) is an important part of the internal physical structure of the chip and can be regarded as a two-dimensional data storage area in the chip. A storage chip usually contains a plurality of Planes, which are physically independent of each other but jointly constitute the storage capacity of the entire storage chip. For example, a three-dimensional NAND Flash, each Plane is composed of a plurality of storage units, which are arranged in the vertical and horizontal directions. From the cross section of the chip, the Plane is like a layer of “data layer”, each Plane has its own independent circuit system for data read and write and erase operation, so that multiple Planes can be operated at the same time, thereby improving the read and write efficiency of the storage chip. In the organization structure of the storage chip, the Plane contains a plurality of blocks, and the block contains a plurality of pages. The page is the smallest unit of data read and write, and the block is the smallest unit of erase operation. For example, in a NAND Flash, a Plane may contain thousands of blocks, and each block may contain dozens to hundreds of pages. The storage path of data in the storage chip is from the Plane to the block and then to the page.
[0039] S3, a non-empty storage block of the virtual binding number is obtained from the source block queue as a to-be-bound block according to a preset first rule.
[0040] Please continue to refer to Figure 3 , Figure 3 is a flowchart of the method for obtaining the to-be-bound block according to the preset first rule in the storage block virtual binding method provided by the embodiment of the application, as shown in Figure 3 , comprising the following steps S31 to S32.
[0041] S31, traversing the source block queue in time sequence for the first time, obtaining the stored data amount and the storage surface number of the non-empty storage block in the source block queue.
[0042] S32, obtaining the non-empty storage blocks with the same storage surface number as the virtual binding quantity according to the stored data amount and the storage surface number.
[0043] It should be noted that after obtaining the non-empty storage block, the non-empty storage block can also be detected for bad block. If the obtained non-empty storage block is a bad block, the non-empty storage block detected as a bad block does not perform the virtual binding operation, and the non-empty storage block is sent to the bad block processing module.
[0044] Please continue to refer to Figure 4 , Figure 4 is the flowchart of obtaining the non-empty storage block as the to-be-bound block in the storage block virtual binding method provided by the embodiment of the application, as shown in Figure 4 , comprising the following steps S321 to S324.
[0045] S321, judging whether the stored data amount of the non-empty storage block currently traversed for the first time is greater than a preset storage data amount threshold.
[0046] The setting of the data amount threshold can help to more effectively allocate the storage block. The storage block size of the storage chip can be the same, but the data storage demand is various. By setting the threshold, for example, it is specified that a storage block stores at most 80% of the data amount, which can avoid the situation that some storage blocks are excessively filled, 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 storage chip.
[0047] S322, if greater than the preset storage data amount threshold, obtaining the non-empty storage block currently traversed for the first time as a first temporary storage block, and setting the storage surface number of the first temporary storage block as a first surface number.
[0048] S323, pausing the first traversal, and performing the second traversal from the next non-empty storage block of the first temporary storage block, obtaining the non-empty storage block with the same storage surface number as the first surface number and greater than the preset storage data amount threshold as a second temporary storage block.
[0049] In step S323, the obtained storage blocks are storage blocks with the same Plane number. On the one hand, different Planes usually have similar storage capacity and performance characteristics. When the storage blocks in a Plane are almost full, the contents of the storage blocks can be dispersed to other Planes, so that the remaining space of the other Planes can be better utilized, and the overall storage efficiency of the storage chip can be improved, and the waste of space of a certain Plane can be avoided. On the other hand, the multiple Planes of the storage chip have the capability of parallel operation, such as simultaneous data writing or reading. After the almost full storage blocks are dispersed to different Planes, the parallelism can be better exerted in subsequent data operations. For example, when the data in the almost full storage blocks needs to be read or updated, since the almost full storage blocks are distributed in different Planes, multiple Planes can operate simultaneously, so that the data processing speed is accelerated, and the performance of the storage system is improved.
[0050] S324, when the number of the obtained second temporary storage blocks is equal to the virtual binding number minus 1, stop the second iteration and the first iteration, and set the first temporary block and the second temporary block as the to-be-bound blocks.
[0051] Please continue to refer to Figure 5 , Figure 5 is a flowchart of the method for virtually binding storage blocks provided in the embodiments of the present application, as shown in Figure 5 , comprising the following steps S325 to S326.
[0052] S325, if the number of the obtained second temporary blocks is less than the virtual binding number minus 1 when the second iteration is completed, then restart the first iteration.
[0053] In the current Plane, when the number of the non-empty storage blocks satisfying the above block data amount screening condition is less than the virtual binding number, then other Planes are continuously detected.
[0054] S326, repeat the steps of judging whether the stored data amount of the non-empty storage block currently iterated by the first iteration is greater than the preset stored data amount threshold to setting the first temporary block and the second temporary block as the to-be-bound blocks.
[0055] In particular, when the number of the detected non-empty storage blocks does not satisfy the execution condition for executing the virtual binding, the subsequent virtual binding step can be temporarily not executed, and the step of the virtual binding is re-executed when the non-empty storage blocks of the target chip satisfy the execution condition for executing the virtual binding.
[0056] S4, obtain the virtual binding number of empty storage blocks from the storage faces of the target storage chip as the target blocks according to the preset second rule.
[0057] Please continue to refer to Figure 6 , Figure 6 is a flowchart of the process of obtaining empty storage blocks in the storage block virtual binding method provided by the embodiments of the present application, as shown in Figure 6 , comprising the following steps S41 to S42.
[0058] S41, calculating the number of empty blocks of empty storage blocks in each storage plane of the target storage chip.
[0059] S42, obtaining 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 obtained empty storage blocks is equal to the virtual binding number.
[0060] Among them, the empty storage blocks are first obtained from the Plane with the most empty storage blocks, similar to using the warehouse with sufficient resources first when allocating resources, which can ensure that the storage resources inside the storage chip are used most effectively. If not in the above manner, it may cause some Plane's empty storage blocks to be idle, while some Plane's storage blocks are filled up too early, thereby reducing the overall storage efficiency. For example, in a NAND Flash chip with multiple storage Planes, assuming that Plane A has a large number of empty storage blocks, while the other Planes have fewer empty storage blocks. According to the principle of first obtaining from the Plane with the most empty storage blocks, Plane A's space can be fully utilized, avoiding occupying the storage blocks of other Planes when they are running out of space. On the other hand, data read and write operations within the same Plane are usually faster than cross-Plane operations, because within the same Plane, the data channel and control circuit are relatively simple, and the data transmission delay is smaller. By first obtaining storage blocks from the Plane with the most empty storage blocks, more data can be stored in the same Plane, and the fast read and write characteristics of the Plane can be fully utilized during data read and write.
[0061] Please continue to refer to Figure 7 , Figure 7 is a flowchart of the process of updating the virtual binding number in the storage block virtual binding method provided by the embodiments of the present application, as shown in Figure 7 , comprising the following steps S43 to S44.
[0062] S43, if the number of obtained empty storage blocks is less than the virtual binding number, then the virtual binding number is reduced by 1 to obtain a second virtual binding number, and the virtual binding number is updated using the second virtual binding number.
[0063] S44, using the updated virtual binding number to perform a step of calculating the number of empty blocks in each storage plane of the target storage chip to obtain a number of empty storage blocks equal to the virtual binding number.
[0064] Where the initial preset virtual binding number results in the inability to find a corresponding number of different storage planes (Plane) of the empty storage blocks to be virtually bound, a downgrade process can also be performed, such as downgrading the process of virtually binding 6 different storage planes (Plane) to a virtual binding operation of 5, 4, 3, and 2 storage planes (Plane), greatly enhancing the flexibility of the storage block virtual binding and improving the read-write performance of the storage chip.
[0065] Please refer to Figure 8 , Figure 8 is an example of obtaining empty storage blocks in the storage block virtual binding method provided by the embodiments of the present application, as Figure 8 shown, the number of known storage planes (Plane) is 6, and the above-mentioned virtual binding number is set to 3, then according to the above-mentioned steps, three empty storage blocks 1P1, 1P3 and 1P5 can be obtained, which correspond to Plane1, Plane3 and Plane5 respectively.
[0066] S5, write the page data of the to-be-bound block to the destination block through the page register to obtain a storage block virtual binding result.
[0067] As an optional implementation, after the above-mentioned step S5, the data of the to-be-bound block can also be emptied to obtain a new empty storage block. Then, the step of calculating the number of empty blocks in each storage plane of the target storage chip is re-executed. That is, after a round of virtual binding, the new empty storage block is recycled to further obtain more empty storage blocks, thereby improving the full capacity of the storage chip.
[0068] The storage block virtual binding method provided by the embodiments of the present application 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 number, wherein the virtual binding number is less than or equal to the number of storage planes of the target storage chip; obtains the virtual binding number of non-empty storage blocks from the source block queue as to-be-bound blocks according to a preset first rule; obtains the virtual binding number of empty storage blocks from the storage planes of the target storage chip as destination blocks according to a preset second rule; writes the page data of the to-be-bound block to the destination block through the page register to obtain a storage block virtual binding result; in this way, the read-write performance and full capacity of the storage chip are improved.
[0069] Please continue to refer to Figure 9An embodiment of the present application provides a storage block virtual binding device, Figure 9 is a system structure schematic diagram of the storage block virtual binding device provided by the embodiment of the present application, as Figure 9 indicated in the figure, the storage block virtual binding device 90 comprises 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 used for searching non-empty storage blocks in a target storage chip and sending the searched non-empty storage blocks to a source block queue in time sequence. The virtual binding quantity module 92 is used for acquiring a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the number of storage surfaces of the target storage chip. The first block acquisition module 93 is used for acquiring the virtual binding quantity of the non-empty storage blocks from the source block queue as to-be-bound blocks according to a preset first rule. The second block acquisition module 94 is used for acquiring the virtual binding quantity of empty storage blocks from the storage surfaces of the target storage chip as destination blocks according to a preset second rule. The virtual binding execution module 95 is used for writing page data of the to-be-bound blocks into the destination blocks through a page register to obtain a storage block virtual binding result.
[0070] As an implementation manner, the first block acquisition module 93 is specifically used for traversing the source block queue in time sequence for the first time, acquiring the stored data amount and the storage surface number of the non-empty storage blocks in the source block queue, and acquiring the virtual binding quantity of the non-empty storage blocks as the to-be-bound blocks according to the stored data amount and the storage surface number, wherein the storage surface numbers of all the to-be-bound blocks are the same.
[0071] As an implementation manner, the first block acquisition module 93 is specifically further used for judging whether the stored data amount of the non-empty storage block currently traversed for the first time is greater than a preset stored data amount threshold value; if greater than the preset stored data amount threshold value, acquiring the non-empty storage block currently traversed for the first time as a first temporary storage block, setting the storage surface number of the first temporary storage block as a first surface number, pausing the first traversal, performing second traversal from the next non-empty storage block of the first temporary storage block, acquiring a non-empty storage block with the storage surface number equal to the first surface number and the stored data amount greater than the preset stored data amount threshold value as a second temporary storage block, and stopping the second traversal and the first traversal when the number of the acquired second temporary storage blocks is equal to the virtual binding quantity minus 1, and setting the first temporary block and the second temporary block as the to-be-bound blocks.
[0072] As an implementation form, the first block obtaining module 93 is specifically further configured to restart the first iteration if the number of the second temporary blocks obtained at the end of the second iteration is less than the virtual binding number minus 1; and repeat the steps of judging whether the stored data amount of the non-empty storage block currently iterated by the first iteration is greater than the preset stored data amount threshold and setting the first temporary block and the second temporary block as the to-be-bound blocks.
[0073] As an implementation form, the second block obtaining module 94 is specifically configured to calculate the number of empty blocks in each storage surface of the target storage chip; and obtain an empty storage block from different storage surfaces in descending order of the number of empty blocks, wherein the number of the obtained empty storage blocks is equal to the virtual binding number.
[0074] As an implementation form, the second block obtaining module 94 is specifically further configured to, if the number of the obtained empty storage blocks is less than the virtual binding number, obtain a second virtual binding number by subtracting 1 from the virtual binding number, update the virtual binding number by using the second virtual binding number, and perform the steps of calculating the number of empty blocks in each storage surface of the target storage chip and obtaining the empty storage blocks in the number equal to the virtual binding number by using the updated virtual binding number.
[0075] As an implementation form, the second block obtaining module 94 is specifically further configured to empty the data of the to-be-bound blocks to obtain new empty storage blocks, and re-perform the step of calculating the number of empty blocks in each storage surface of the target storage chip.
[0076] An embodiment of the present application provides a chip, please refer to Figure 10 As shown in the figure, the chip 100 comprises 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 complete mutual communication through the communication bus 104; the memory 103 is used for storing a computer program; and the processor 101 is used for executing the program stored in the memory 103 to realize the steps of the storage block virtual binding method.
[0077] The processor 101 can also be a CPU (Central Processing Unit). The processor 101 can also be an integrated circuit chip with a processing capability of signals. The processor 101 can also be a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0078] The memory 103 can be a ROM (Read-Only Memory) for example. The processor 101 and the memory 103 are connected to each other through the communication bus 104. The communication interface 102 is also connected to the communication bus 104.
[0079] Referring to Figure 11 , Figure 11 FIG. 1 is a structural schematic diagram of a computer readable storage medium according to an embodiment of the present application. The computer readable storage medium 110 according to the embodiment of the present application stores a computer program 111 capable of implementing all the methods described above. The computer program 111 is computer executable instructions or a computer program. The computer program 111 can be stored in the computer readable storage medium in the form of a software product. The computer program 111 can include a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present application. The computer readable storage medium 110 can be a non-volatile storage medium or a volatile storage medium. The computer readable storage medium 110 described above can include a U disk, a mobile hard disk, a ROM (Read-Only Memory), a RAM (Random Access Memory), a magnetic disk or an optical disk, and various media capable of storing program codes, or a terminal device such as a computer, a server, a mobile phone, a tablet, etc.
[0080] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only schematic. The division of units is only a logical function division. Actual implementation can have another division manner. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0081] In addition, each of the functional units in the various embodiments of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware or in the form of a software functional unit. The above is merely an implementation of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, which is made by using the content of the present application specification and drawings, is also included in the patent protection scope of the present application.
[0082] The above is merely an implementation of the present application, and it should be noted that, for those skilled in the art, improvements can be made without departing from the inventive concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A method for virtual binding of storage blocks, characterized in that, The method includes: Search for non-empty memory blocks in the target memory chip and send the found non-empty memory blocks to the source block queue in a preset time order; Obtain a preset number of virtual bindings, wherein the number of virtual bindings is less than or equal to the number of storage surfaces of the target storage chip; According to a preset first rule, the number of non-empty storage blocks of the specified virtual binding quantity are obtained from the source block queue as blocks to be bound; According to the preset second rule, the number of virtual-bound empty storage blocks are obtained from the storage surface of the target storage chip as the target blocks; The page data of the block to be bound is written to the destination block through the page register to obtain the storage block virtual binding result; The step of obtaining the number of virtual-bound 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 in chronological order for the first time to obtain the amount of stored data and the storage surface number of the non-empty storage blocks in the source block queue; obtaining the number of virtual-bound non-empty storage blocks as blocks to be bound based on the amount of stored data and the storage surface number, wherein all blocks to be bound have the same storage surface number; The step of obtaining the number of empty storage blocks of the virtual binding quantity from the storage surface of the target storage chip according to the preset second rule includes: calculating the number of empty blocks in each storage surface of the target storage chip; obtaining an empty storage block from different storage surfaces in descending order of the number of empty blocks, wherein the number of empty storage blocks obtained is equal to the number of virtual bindings.
2. The storage block virtual binding method according to claim 1, characterized in that, The step of obtaining the number of non-empty storage blocks to be bound based on the amount of stored data and the storage surface number includes: Determine whether the amount of data already stored in the non-empty storage block that is currently being traversed for the first time is greater than the preset data storage threshold; If the data volume exceeds the preset storage data threshold, the non-empty storage block currently being traversed in 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. Pause the first traversal, and perform a second traversal from the next non-empty storage block of the first temporary storage block. Obtain a non-empty storage block whose storage face number is equal to the first face number and whose stored data amount is greater than the preset storage data amount threshold as the second temporary storage block. When the number of the second temporary storage blocks obtained is equal to the number of virtual bindings minus 1, stop the second traversal and the first traversal, and set the first temporary storage block and the second temporary storage block as the blocks to be bound.
3. The storage block virtual binding method according to claim 2, 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 amount is greater than the preset storage data amount 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 storage blocks acquired is less than the number of virtual bindings minus 1, then the first traversal is restarted. Repeat the steps from determining whether the amount of stored data in the non-empty storage block currently being traversed in the first pass is greater than a preset data storage threshold to setting the first temporary storage block and the second temporary storage block as the block to be bound.
4. The storage block virtual binding method according to claim 1, characterized in that, After the step of obtaining an empty storage block from different storage surfaces in descending order of the number of empty blocks, the method further includes: If the number of empty storage blocks obtained is less than the number of virtual bindings, then the number of virtual bindings is reduced by 1 to obtain a second number of virtual bindings, and the number of virtual bindings is updated using the second number of virtual bindings. Perform the steps between calculating the number of empty blocks in each storage plane of the target storage chip and obtaining the number of empty blocks equal to the number of virtual bindings, using the updated virtual binding quantity.
5. The storage block virtual binding method according to claim 1, characterized in that, After the step of writing the page data of the block to be bound to the destination block through the page register to obtain the virtual binding result of the storage block, the method further includes: Clear the data in the block to be bound to obtain a new empty storage block; Repeat the step of calculating the number of empty blocks in each memory surface of the target memory chip.
6. A storage block virtual binding device, characterized in that, include: The source block queue module is used to 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 chronological order. The virtual binding quantity module is used to obtain a preset virtual binding quantity, wherein the virtual binding quantity is less than or equal to the number of storage surfaces of the target storage chip; The first acquisition module is used to acquire the number of non-empty storage blocks to be bound from the source block queue according to a preset first rule; The second acquisition module is used to acquire the number of empty storage blocks of the virtual binding quantity from the storage surface of the target storage chip as the target 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 to the destination block through the page register to obtain the virtual binding result of the storage block; Specifically, the first block acquisition module is used to traverse the source block queue in chronological order for the first time, and obtain the amount of stored data and the storage surface number of the non-empty storage blocks in the source block queue; and obtain the number of non-empty storage blocks to be bound as the number of virtual binding blocks based on the amount of stored data and the storage surface number, wherein all the storage surface numbers of the blocks to be bound are the same. Specifically, the second acquisition module is used to calculate the number of empty blocks in each storage surface of the target storage chip; and to acquire an empty storage block from different storage surfaces 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.
7. A chip, characterized in that, It 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; Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the steps of the storage block virtual binding method according to any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the storage block virtual binding method as described in any one of claims 1-5.
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