Memory management method and memory controller
By group binding and virtual block mapping of the physical blocks of the flash memory, the flexibility and efficiency problems of the traditional virtual block management model are solved, garbage collection and host user data writing are performed simultaneously, and the storage device is improved. work efficiency and user experience.
Patent Information
- Application Number
- CN202410764363.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-14
AI Technical Summary
In the existing flash memory firmware design, the traditional virtual block management mode lacks flexibility, which affects storage space utilization, and needs to avoid host user data writing during garbage collection operations, resulting in low efficiency.
By grouping and binding multiple physical blocks, multiple sets of virtual blocks are obtained, allowing host user data writing during garbage collection operations, utilizing single-level and multi-level storage unit type blocks for virtual block mapping and Garbage collection operations and group processing improve efficiency.
The garbage collection operation and host user data writing are performed simultaneously, which improves the operating efficiency of the storage device, enhances the user experience, and avoids the problem of low efficiency in traditional methods.
Smart Images

Figure CN118331511B
Abstract
Description
Technical Field
[0001] The present invention relates to a memory management technology, and in particular to a memory controller for a storage device equipped with a non-volatile memory and a memory management method used therein. Background Art
[0002] Non-volatile memory refers to computer memory whose stored data does not disappear when the current is cut off. It has the advantages of non-volatility, power saving, small size and no mechanical structure, and is widely used in various electronic devices.
[0003] Common non-volatile memory is a memory configured with flash memory (such as solid-state hard disk), which has the characteristics of high read and write speed, no need for mechanical structure to access data, etc. In the existing flash memory firmware design, the management of physical blocks is to bundle all physical blocks with the same block number in the flash memory into a virtual block for management. This traditional virtual block management mode lacks flexibility and affects the utilization of storage space, and is no longer applicable. Summary of the invention
[0004] The purpose of the present invention is to solve the above problems. In addition to being able to effectively bind physical blocks to obtain virtual areas, partition binding can also be performed so that the storage device can normally perform write operations during the garbage collection operation, thereby increasing the operating efficiency of the storage device.
[0005] One or more embodiments of the present invention provide a memory management method for a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module includes a plurality of physical channels respectively corresponding to a plurality of memory chips, and each of the memory chips includes a plurality of physical blocks arranged in sequence according to a plurality of physical block numbers. The method comprises: performing a first virtual block mapping operation on the multiple physical blocks of the multiple memory chips corresponding to the multiple physical channels to obtain multiple virtual blocks for performing a host write operation; when the number of the blank physical blocks of a target physical channel among the multiple physical channels is lower than a predetermined threshold, dividing the multiple physical channels into a first physical channel group and a second physical channel group, wherein the first physical channel group at least includes the target physical channel; and releasing the first virtual block mapping operation performed on the multiple physical channels and the multiple physical blocks corresponding to each memory chip, and performing a second virtual block mapping operation on the multiple first physical blocks corresponding to the first physical channel group and the multiple second physical blocks corresponding to the second physical channel group, respectively, to obtain the multiple first virtual blocks corresponding to the first physical channel group and the multiple second virtual blocks corresponding to the second physical channel group; and performing a garbage collection operation on the multiple first virtual blocks corresponding to the first physical channel group, and performing a host write operation on the multiple second virtual blocks corresponding to the second physical channel group.
[0006] In one or more embodiments of the present invention, performing the first virtual block mapping operation on the multiple physical blocks of the multiple memory chips corresponding to the multiple physical channels includes: performing a virtual block mapping operation on multiple first-type physical blocks among the multiple physical blocks, wherein the multiple first-type physical blocks belong to a single-level storage unit type.
[0007] In one or more embodiments of the present invention, obtaining the multiple virtual blocks to perform the host write operation includes: selecting one or more target virtual blocks from the multiple virtual blocks to store write data corresponding to the write instruction; and recording address mapping information of the logical address and the physical address of the corresponding write data according to the physical address of one or more target virtual pages of the one or more target virtual blocks and the logical address of the corresponding write data, wherein the write instruction indicates the logical address and the write data is stored in the one or more target virtual pages.
[0008] In one or more embodiments of the present invention, performing a second virtual block mapping operation on a plurality of first physical blocks corresponding to the first physical channel group and a plurality of second physical blocks corresponding to the second physical channel group, respectively, includes: performing a virtual block mapping operation on a second type of physical blocks among the plurality of first physical blocks corresponding to the first physical channel group, wherein the second type of physical blocks belong to a multi-level storage unit type; and performing a virtual block mapping operation on a first type of physical blocks among the plurality of second physical blocks corresponding to the second physical channel group, wherein the first type of physical blocks belong to a single-level storage unit type.
[0009] In one or more embodiments of the present invention, during the garbage collection operation performed on multiple first physical blocks corresponding to the first physical channel group, if another write instruction is received, one or more target second virtual blocks are selected from the multiple second virtual blocks to store another write data corresponding to the another write instruction; and according to the physical addresses of one or more target second virtual pages of the one or more target second virtual blocks and the logical address of the corresponding another write data, the address mapping information of the logical address and the physical address of the other write data corresponding to the another write instruction is recorded, wherein the write instruction indicates the logical address of the corresponding another write data, and the write data is stored in the one or more target second virtual pages.
[0010] In one or more embodiments of the present invention, after the garbage collection operation of the plurality of first physical blocks corresponding to the first physical channel group is completed, the method further comprises: restoring normal operation of the plurality of first physical blocks corresponding to the first physical channel group, and performing another host write operation on the plurality of first virtual blocks of the first physical channel group; and performing another garbage collection operation on the plurality of second virtual blocks of the second physical channel group;
[0011] After the another garbage collection operation of the plurality of second physical blocks corresponding to the second physical channel group is completed, normal operation of the plurality of second physical blocks corresponding to the second physical channel group is restored, the second virtual block mapping operation is released, and the first virtual block mapping operation is restored.
[0012] In one or more embodiments of the present invention, performing the another host write operation on the plurality of first virtual blocks of the first physical channel group includes: performing a virtual block mapping operation on a first type of physical blocks among the plurality of first physical blocks corresponding to the first physical channel group to obtain the plurality of first virtual blocks, thereby performing the another host write operation on the plurality of first virtual blocks, wherein the first type of physical blocks belong to a single-level storage unit type. Performing the another garbage collection operation on the plurality of second virtual blocks of the second physical channel group includes: performing a virtual block mapping operation on a second type of physical blocks among the plurality of second physical blocks corresponding to the second physical channel group to obtain the plurality of second virtual blocks, thereby performing the another garbage collection operation on the plurality of second virtual blocks, wherein the second type of physical blocks belong to a multi-level storage unit type.
[0013] In one or more embodiments of the present invention, the virtual block mapping operation includes: grouping the multiple physical blocks with the same physical block number into the same virtual block according to the multiple physical channels and the respective physical block numbers of the multiple physical blocks corresponding to each memory chip; and regrouping the multiple physical pages with the same physical page number into the same virtual page of the virtual block to which they belong according to the multiple physical page numbers of the multiple physical pages of the multiple physical blocks grouped into each virtual block.
[0014] In one or more embodiments of the present invention, during the execution of the first virtual block mapping operation on the first type of physical blocks among the plurality of physical blocks, the method further includes: selecting predetermined physical blocks from each physical channel respectively to execute a third virtual block mapping operation to group the plurality of predetermined physical blocks into a plurality of predetermined virtual blocks, wherein the plurality of predetermined physical blocks belong to a multi-level storage unit type; and when executing a system data storage instruction sequence, selecting one or more target predetermined virtual blocks from the plurality of predetermined virtual blocks, and storing corresponding system data in the selected one or more target predetermined virtual blocks, wherein the system data is not user data from the host system.
[0015] In one or more embodiments of the present invention, each memory chip includes multiple planes, and the method further includes: writing data to each virtual physical block via a multi-plane write mechanism, and reading data from each virtual physical block via a multi-plane read mechanism.
[0016] A memory controller is used to control a storage device configured with a rewritable non-volatile memory module. The memory controller includes: a memory interface control circuit for electrically connecting to the rewritable non-volatile memory module, wherein the rewritable non-volatile memory module includes a plurality of physical channels corresponding to a plurality of memory chips, each of the memory chips includes a plurality of physical blocks arranged in sequence according to a plurality of physical block numbers; and a processor electrically connected to the memory interface control circuit, wherein the processor is further electrically connected to a connection interface circuit of the storage device to electrically connect to a host system. The processor is configured to: perform a first virtual block mapping operation on the plurality of physical blocks of the plurality of memory chips corresponding to the plurality of physical channels, and obtain a plurality of virtual blocks to perform a host write operation;
[0017] When the number of blank physical blocks of a target physical channel among the multiple physical channels is lower than a predetermined threshold, dividing the multiple physical channels into a first physical channel group and a second physical channel group, wherein the first physical channel group at least includes the target physical channel; and
[0018] Release the first virtual block mapping operation performed on the plurality of physical channels and the plurality of physical blocks corresponding to each memory chip, and perform a second virtual block mapping operation on the plurality of first physical blocks corresponding to the first physical channel group and the plurality of second physical blocks corresponding to the second physical channel group, respectively, to obtain a plurality of first virtual blocks corresponding to the first physical channel group and a plurality of second virtual blocks corresponding to the second physical channel group; and
[0019] A garbage collection operation is performed on the plurality of first virtual blocks corresponding to the first physical channel group, and a host write operation is performed on the plurality of second virtual blocks corresponding to the second physical channel group.
[0020] Based on the above, the memory controller, storage device and memory management method provided by the embodiments of the present invention can utilize the method of grouping and binding multiple physical blocks to obtain multiple groups of virtual blocks, so that the storage device can perform garbage collection operations and host user data writing operations in groups at the same time, avoiding the defect that traditional garbage collection operations need to avoid host user data writing operations, and enhancing the execution flexibility and efficiency of garbage collection operations, thereby improving the working efficiency of the storage device and enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings are included to provide a further understanding of the present invention and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the present invention and together with the description serve to explain the principles of the present invention.
[0022] Figure 1 is a block diagram of a host system and a storage device according to an embodiment of the present invention;
[0023] Figure 2 is a flowchart of a memory management method according to an embodiment of the present invention;
[0024] Figure 3 is a schematic diagram of the architecture of a memory chip according to an embodiment of the present invention;
[0025] Figure 4 is a schematic diagram of a virtual block mapping operation according to an embodiment of the present invention;
[0026] Figure 5 A schematic diagram of establishing a virtual block and a virtual page according to an embodiment of the present invention;
[0027] Figure 6 is a schematic diagram showing the creation of a virtual block and a virtual page according to another embodiment of the present invention;
[0028] Figure 7 A schematic diagram of updating a logic-to-physical mapping table according to a virtual block according to an embodiment of the present invention;
[0029] Figure 8 A schematic diagram of updating a logical-to-virtual mapping table and a virtual-to-physical mapping table according to a virtual block according to an embodiment of the present invention;
[0030] Fig. 9 A schematic diagram showing updating a logical-to-virtual mapping table and a virtual-to-physical mapping table according to a virtual block according to another embodiment of the present invention;
[0031] Fig.10 A schematic diagram showing a virtual block mapping operation performed based on a garbage collection operation and a normal operation according to an embodiment of the present invention;
[0032] Fig.11 It is a schematic diagram showing how to perform virtual block mapping operations based on system data storage requirements according to an embodiment of the present invention.
[0033] Description of Figure Numbers
[0034] 10: Host system
[0035] 20: Storage device
[0036] 211: First processor
[0037] 110: Second processor
[0038] 120: Host memory
[0039] 130: Data transmission interface circuit
[0040] 210: Memory controller
[0041] 212: Data management circuit
[0042] 213: Memory interface control circuit
[0043] 214: Buffer memory
[0044] 220: Rewritable non-volatile memory module
[0045] 230: Connecting interface circuit
[0046] S210, S220, S230, S240: Process steps of the memory management method
[0047] CH0~CH3: Physical channel
[0048] CE0~CE3: Chip enable pins
[0049] BK1~BK3: Physical blocks
[0050] DI00~DI31: memory chip
[0051] VBK0, VBK10, VBK20: Virtual blocks
[0052] VPG0, VPG1, VPG10, VPG20: virtual pages
[0053] LBA: Logical Address
[0054] PBA: Physical Address
[0055] VNA: Virtual Address
[0056] T71: Logic to entity mapping table
[0057] T81, T91: logical to virtual mapping table
[0058] T82, T92: Virtual to physical mapping table
[0059] A41~A48, A51~A59-2, A62~A69-2, A101~A108, A111~A114: Arrow DETAILED DESCRIPTION
[0060] Reference will now be made in detail to exemplary embodiments of the present invention, examples of which are illustrated in the accompanying drawings. Whenever possible, the same reference numerals are used in the drawings and the description to refer to the same or like parts.
[0061] Figure 1 FIG. 1 is a block diagram of a host system and a storage device according to an embodiment of the present invention. Figure 1 , the host system 10 is, for example, a personal computer, a notebook computer, or a server. The host system 10 includes a processor 110 (also referred to as a second processor), a host memory 120, and a data transfer interface circuit 130. In the present embodiment, the processor 110 is coupled (also referred to as electrically connected) to the host memory 120 and the data transfer interface circuit 130. In another embodiment, the processor 110, the host memory 120, and the data transfer interface circuit 130 are electrically connected to each other using a system bus. In the present embodiment, the processor 110, the host memory 120, and the data transfer interface circuit 130 may be disposed on a motherboard of the host system 10.
[0062] The storage device 20 includes a storage controller 210, a rewritable non-volatile memory module 220, and a connection interface circuit 230. The storage controller 210 includes a processor 211 (also called a first processor), a data management circuit 212, and a memory interface control circuit 213.
[0063] In this embodiment, the host system 10 is electrically connected to the storage device 20 through the data transmission interface circuit 130 and the connection interface circuit 230 of the storage device 20 to perform data access operations. For example, the host system 10 can store data to the storage device 20 or read data from the storage device 20 via the data transmission interface circuit 130.
[0064] In this embodiment, the number of the data transmission interface circuit 130 can be one or more. Through the data transmission interface circuit 130, the motherboard can be electrically connected to the storage device 20 via a wired or wireless manner. The storage device 20 can be, for example, a USB flash drive, a memory card, a solid state drive (SSD) or a wireless memory storage device. The wireless memory storage device can be, for example, a near field communication (NFC) memory storage device, a wireless fax (WiFi) memory storage device, a Bluetooth memory storage device or a low power consumption Bluetooth memory storage device (e.g., iBeacon) and other memory storage devices based on various wireless communication technologies. In addition, the motherboard can also be electrically connected to various I / O devices such as a global positioning system (GPS) module, a network interface card, a wireless transmission device, a keyboard, a screen, a speaker, etc. through a system bus.
[0065] In this embodiment, the data transmission interface circuit 130 and the connection interface circuit 230 are interface circuits compatible with the high-speed peripheral component interconnect interface (Peripheral Component Interconnect Express, PCI Express) standard. In addition, the data transmission between the data transmission interface circuit 130 and the connection interface circuit 230 is performed using the fast non-volatile memory interface standard (Non-Volatile Memory express, NVMe) communication protocol.
[0066] Furthermore, in another embodiment, the connection interface circuit 230 and the memory controller 210 may be packaged in one chip, or the connection interface circuit 230 may be disposed outside a chip including the memory controller 210 .
[0067] In this embodiment, the host memory 120 is used to temporarily store instructions or data executed by the processor 110. For example, in this embodiment, the host memory 120 can be a dynamic random access memory (DRAM), a static random access memory (SRAM), etc. However, it should be understood that the present invention is not limited thereto, and the host memory 120 can also be other suitable memories.
[0068] The memory controller 210 is used to execute a plurality of logic gates or control instructions implemented in hardware or firmware and to perform operations such as writing, reading and erasing data in the rewritable non-volatile memory module 220 according to instructions of the host system 10 .
[0069] In more detail, the processor 211 in the memory controller 210 is hardware with computing capabilities, which is used to control the overall operation of the memory controller 210. Specifically, the processor 211 is programmed by a plurality of control instructions / program codes, and when the storage device 20 operates, these control instructions / program codes are executed to perform operations such as writing, reading and erasing data. In addition, in this embodiment, the control instructions / program codes can also be executed to perform data reading operations to implement the data reading method provided by the present invention. The control instructions / program codes corresponding to the data reading method can also be implemented as a circuit unit in the form of hardware to implement the data reading method provided by the present invention.
[0070] It is worth mentioning that in the present embodiment, the processor 110 and the processor 211 are, for example, a central processing unit (CPU), a microprocessor, or other programmable processing units (Microprocessor), a digital signal processor (DSP), a programmable controller, an application specific integrated circuit (ASIC), a programmable logic device (PLD) or other similar circuit components, but the present invention is not limited thereto.
[0071] In this embodiment, as described above, the memory controller 210 further includes a data management circuit 212 and a memory interface control circuit 213. It should be noted that the operations performed by the various components of the memory controller 210 can also be regarded as the operations performed by the memory controller 210.
[0072] The data management circuit 212 is electrically connected to the processor 211, the memory interface control circuit 213 and the connection interface circuit 230. The data management circuit 212 is used to receive instructions from the processor 211 to transmit data. For example, data is read from the host system 10 (e.g., the host memory 120) via the connection interface circuit 230, and the read data is written to the rewritable non-volatile memory module 220 via the memory interface control circuit 213 (e.g., the write operation is performed according to the write instruction from the host system 10). For another example, data is read from one or more physical units of the rewritable non-volatile memory module 220 via the memory interface control circuit 213 (the data can be read from one or more storage units in the one or more physical units), and the read data is written to the host system 10 (e.g., the host memory 120) via the connection interface circuit 230 (e.g., the read operation is performed according to the read instruction from the host system 10). In another embodiment, the data management circuit 212 can also be integrated into the processor 211.
[0073] The memory interface control circuit 213 is used to receive instructions from the processor 211 and cooperate with the data management circuit 212 to perform a write (also called programming) operation, a read operation or an erase operation on the rewritable non-volatile memory module 220 .
[0074] In addition, the data to be written to the rewritable non-volatile memory module 220 will be converted into a format acceptable to the rewritable non-volatile memory module 220 via the memory interface control circuit 213. Specifically, if the processor 211 wants to access the rewritable non-volatile memory module 220, the processor 211 will transmit a corresponding instruction sequence to the memory interface control circuit 213 to instruct the memory interface control circuit 213 to perform a corresponding operation. For example, these instruction sequences may include a write instruction sequence indicating writing data, a read instruction sequence indicating reading data, an erase instruction sequence indicating erasing data, and corresponding instruction sequences for indicating various memory operations. These instruction sequences may include one or more signals, or data on the bus. These signals or data may include instruction codes or program codes. For example, in a read instruction sequence, information such as a read identification code, a memory address, and a physical address may be included.
[0075] In addition, the memory controller 210 establishes a logical to physical address mapping table and a physical to logical address mapping table to record the mapping relationship between the logical address of the logical unit (e.g., logical block, logical page or logical column) configured for the rewritable non-volatile memory module 220 and the physical address (physical address) of the physical unit (e.g., physical erase unit / physical block, physical page, physical column). In other words, the memory controller 210 can search for the physical unit mapped by a logical unit (e.g., search for the physical page mapped by a logical page; search for the physical address mapped by a logical address) through the logical to physical address mapping table (also called the logical to physical mapping table), and the memory controller 210 can search for the logical unit mapped by a physical unit (e.g., search for the logical page mapped by a physical page; search for the logical address mapped by a physical address) through the physical to logical address mapping table (also called the physical to logical mapping table).
[0076] In one embodiment, the memory controller 210 further includes a buffer memory 214. The buffer memory is electrically connected to the processor 211 and is used to temporarily store data and instructions from the host system 10, data from the rewritable non-volatile memory module 220, or other system data (e.g., various mapping tables, index tables, address lists) used to manage the storage device 20, so that the processor 211 can quickly access the data, instructions or system data from the buffer memory 216.
[0077] The rewritable non-volatile memory module 220 is electrically connected to the memory controller 210 (memory interface control circuit 213 ) and is used to store data written by the host system 10 .
[0078] In this embodiment, the rewritable non-volatile memory module 220 has a plurality of word lines, wherein each of the plurality of word lines is electrically connected to a plurality of storage cells, also known as columns (also known as physical columns). A plurality of columns on the same word line constitute a physical programming unit (also known as a physical page). Each physical page corresponds to a physical address for recording the location of the data stored in the physical page. In addition, a plurality of physical pages may constitute a physical block (also known as a physical erase unit). Each memory grain (chip) of the plurality of memory grains of the rewritable non-volatile memory module has a plurality of planes, and each plane has a plurality of physical blocks.
[0079] In this embodiment, each storage unit (storage cell) can store 1 or more bits of data. The type of storage cell storing 1 bit is a single-level storage cell (SLC) type, and the multi-level storage cell type storing multiple bits (also referred to as XLC) can be divided into a second-level storage cell (MLC) storing 2 bits, a third-level storage cell (TLC) storing 3 bits, a fourth-level storage cell (QLC) storing 4 bits, and a fifth-level storage cell (PLC) storing 5 bits. The characteristics of SLC are fast storage rate and good stability, and the characteristics of XLC are large available storage space, slow speed and less stability. All storage cells in a physical block will belong to the same type. For example, a single-level storage cell physical block in which all storage cells are of the single-level storage cell type, and a three-level storage cell physical block in which all storage cells are of the three-level storage cell type.
[0080] It should be noted that the present invention is not limited to the size of each physical page and logical page.
[0081] Figure 2 The figure is a flowchart of a memory management method according to an embodiment of the present invention.
[0082] Please refer to Figure 2 In step S210, the memory controller 210 (processor 211) performs a first virtual block mapping operation on the multiple physical blocks of the multiple memory chips corresponding to the multiple physical channels to obtain multiple virtual blocks to perform a host write operation.
[0083] In one embodiment, the memory controller 210 identifies multiple physical channels of the rewritable nonvolatile memory module, multiple chip enable pins corresponding to each physical channel, and a target memory chip corresponding to each chip enable pin. Here, the target memory chip is a memory chip that performs a virtual block mapping operation.
[0084] Channel (CH) pins (also called physical channels) are a group of physical pins in the rewritable non-volatile memory module 220, which are responsible for receiving and transmitting data and commands.
[0085] The chip enable (CE) pin is used to select or deselect the memory chip. Each CE pin corresponds to a physical chip (memory chip). If a chip enable pin is in a valid state, the corresponding physical chip is selected.
[0086] The target memory chip corresponding to each chip enable pin includes multiple physical blocks arranged in sequence according to multiple physical block numbers, wherein the multiple physical block numbers corresponding to each target memory chip are multiple numbers arranged in the same sequence, wherein each physical block includes multiple physical pages arranged in sequence according to multiple physical page numbers.
[0087] Figure 3 FIG. 1 is a schematic diagram of a memory chip structure according to an embodiment of the present invention. Figure 3 The memory interface control circuit 213 is electrically connected to a plurality of memory chips DI00-DI31 through a plurality of physical channels CH0-CH3, wherein each physical channel corresponds to two chip enable pins. For example, the physical channel CH0 corresponds to two chip enable pins CE0 and CE1.
[0088] In addition, each memory chip can be enabled by triggering the corresponding chip enable pin. For example, when the CE pin of the corresponding memory chip DI00 is selected / triggered, the memory chip DI00 is in an enabled state and can store / read data.
[0089] In this embodiment, each memory chip may have multiple physical blocks. For example, each memory chip has three physical blocks BK1-BK3. In one embodiment, each memory chip has two (or more) planes, and each plane has multiple physical blocks.
[0090] In addition, different CE pins corresponding to the physical channels cannot be selected at the same time, and the efficiency can only be improved through the interleaving mechanism. Physical blocks in different planes under the same CE can be accessed (written / read) in parallel, but the limitation is that the physical block numbers of the physical blocks accessed in parallel need to be the same.
[0091] In this embodiment, a plurality of physical channels CH0 - CH3 of the rewritable non-volatile memory module 220 are electrically connected to a plurality of memory chips DI00 - DI31 .
[0092] It should be noted that the number and configuration of each element in the above architecture are exemplary and are only used for convenience of description, and do not limit the present invention. For example, each memory chip may have more than three physical blocks. Each physical channel corresponds to 4 or more chip enable pins.
[0093] In one embodiment, the virtual block mapping operation includes: grouping the multiple physical blocks having the same physical block number into the same virtual block according to the multiple physical channels and the respective physical block numbers of the multiple physical blocks corresponding to each memory chip; and regrouping the multiple physical pages having the same physical page number into the same virtual page of the virtual block to which they belong according to the multiple physical page numbers of the respective multiple physical pages of the multiple physical blocks grouped into each virtual block.
[0094] In one embodiment, the memory controller 210 groups the multiple physical blocks into the multiple virtual blocks according to the multiple physical channels, the multiple chip enable pins, and the physical block numbers of the multiple physical blocks corresponding to each target memory chip, wherein the number of the multiple virtual blocks is less than the number of the multiple physical blocks, and the multiple physical blocks grouped into the same virtual block have the same physical block number. In other words, it can be considered that all the physical blocks with the same number in all CE pins corresponding to all CH pins are bound to one virtual block.
[0095] In addition to all physical blocks with the same number being bound to one virtual block, the memory controller 210 regroups the multiple physical pages into multiple virtual pages of the corresponding virtual block according to the multiple physical page numbers of the multiple physical pages of the multiple physical blocks grouped into each virtual block, wherein the number of the multiple virtual pages is less than the number of the multiple first physical pages, and the multiple physical pages grouped into the same virtual page have the same physical page number.
[0096] In some embodiments, the memory controller 210 performs a virtual block mapping operation on a first type of physical block among a plurality of physical blocks of a plurality of memory chips corresponding to a plurality of physical channels, wherein the first type of physical block belongs to a single-level cell (SLC) type. After the virtual block mapping, the first type of virtual block is obtained to perform a host write operation, and when the memory is in an idle state, the data in the first type of physical block constituting the first type of virtual block is moved to a second type of physical block, wherein the second type of physical block belongs to a multi-level cell (XLC) type.
[0097] On the one hand, since the write speed of SLC is fast, using SLC type blocks for host write operations can improve the write speed. On the other hand, when binding to virtual blocks to further improve the write speed, the smaller size of SLC blocks can ensure the utilization of storage space and reduce the waste of storage resources caused by the excessive size of storage blocks when binding virtual blocks to write.
[0098] In addition, after performing a virtual block mapping operation and binding multiple physical blocks to obtain multiple virtual areas, data can be written by implementing parallel writing of multiple CHs and multiple CEs. The speed of parallel writing is faster than single-line writing.
[0099] In particular, in the first virtual mapping block operation, multiple SLC type physical blocks are specifically bound. On the basis that the writing speed of SLC itself is faster than that of XLC, performing parallel writing by binding the SLC type physical blocks will make the host write operation faster than non-parallel writing, or faster than using XLC for parallel writing.
[0100] In flash memory, the smallest write unit is a page. If XLC is used for parallel writing, the storage page is too large and the data is broken into small blocks for parallel writing. Each small block of data may be less than a page in size. In order to meet the minimum write unit, invalid data needs to be filled to the storage page size before writing, which will result in a large amount of space waste in the storage page.
[0101] Figure 4 FIG. 1 is a schematic diagram of a virtual block mapping operation according to an embodiment of the present invention. Figure 4 In the present embodiment, first, the memory controller 210 selects a plurality of physical blocks BK0 having the same physical block number in the target memory chip corresponding to the CH pins (i.e., physical channels) CH0~CH3 and the CE pins CE0~CE1, and groups / sets them as virtual blocks VBK0.
[0102] For example, as shown by arrow A41, the memory controller 210 selects the first physical block BK0 from the target memory chip DI00 corresponding to the CH pin CH0 and the CE pin CE0 to group it into the virtual block VBK0. Then, as shown by arrows A42 to A48, the memory controller 210 selects the physical blocks BK0 of the same order (same physical block number) from the target memory chips DI01 to DI31 to group them into the virtual block VBK0.
[0103] In one embodiment, when the number of the plurality of physical channels is X and the number of the plurality of chip enable pins corresponding to each physical channel is Y, the number of the plurality of physical blocks of each grouped virtual block is X*Y, and the number of the plurality of physical pages of each virtual page is X*Y. Figure 4 In the example, the number of CH pins (X) is 4, and the number of chip enable pins (Y) of each physical channel is 2. In this case, the number of physical blocks BK0 grouped into the virtual block VBK0 is 8 (X*Y=4*2=8). In addition, the number of physical pages grouped into one virtual page of each virtual block is also 8 (X*Y=4*2=8).
[0104] In addition, the virtual block number of each virtual block is equal to the physical block numbers of the plurality of physical blocks owned by each virtual block, and the plurality of virtual blocks of the target memory chip are sorted according to the respective virtual block numbers.
[0105] After obtaining the virtual block VBK0 , the memory controller 210 selects the next physical block from the target memory chips DI00 - DI31 corresponding to the CH pin CH0 and the CE pin CE0 to obtain the next virtual block.
[0106] In addition, the multiple physical pages of the multiple physical blocks BK0 grouped into the virtual block VBK0 are further arranged according to a specific method to form multiple virtual pages of the virtual block VBK0.
[0107] Figure 5 FIG. 1 is a schematic diagram of establishing a virtual block and a virtual page according to an embodiment of the present invention. Figure 5 , “CH0, CE0, BK0” represents a physical block BK0 corresponding to a CH pin CH0 and a CE pin CE0. Assume that each physical block includes a plurality of physical pages PG0, PG1, . . .
[0108] like Figure 5 As shown, the virtual block VBK0 includes physical pages PG0, PG1, ... from 8 physical blocks "CH0, CE0, BK0", "CH0, CE1, BK0", "CH1, CE0, BK0", "CH1, CE1, BK0", "CH2, CE0, BK0", "CH2, CE1, BK0", "CH3, CE0, BK0", "CH3, CE1, BK0", which constitute virtual pages VPG0, VPG1, ... of the virtual block VBK0 (e.g., virtual page VPG0 includes 8 physical pages PG0, and virtual page VPG0 includes 8 physical pages PG1).
[0109] In one embodiment, the virtual page number of each virtual page is equal to the physical page numbers of the multiple physical pages owned by each virtual page. For example, the virtual page number / order of virtual page VPG0 is equal to the physical page number / order of the physical page PG0 owned by it in the physical block to which it belongs. In addition, the multiple virtual pages in each virtual block are sorted according to their respective virtual page numbers (e.g., sorted in the order of VPG0, VPG1, ...).
[0110] In this embodiment, the memory controller 210 first sorts the multiple physical pages with the same physical page number of each virtual page according to the corresponding physical channel number and then according to the corresponding chip enable pin number. The above sorting order can also be regarded as the order of grouping the multiple physical pages PG0, PG1, ... of the multiple physical blocks BK0 into the multiple virtual pages VPG0, VPG1, ... of the virtual block VBK0.
[0111] Since the sorting / grouping is first performed according to the corresponding physical channel number, the memory controller 210 will first sort / group in the order of CH pins CH0~CH3, and then in the order of CE pins CH0 and CH1 in each CH pin. For example, in order to form a virtual page VPG0, as shown by arrow A51, the memory controller 210 first selects the physical page PG0 in the physical block BK0 corresponding to CH0 and CE0 to be grouped into the virtual page VPG0; then, as shown by arrow A52, the physical page PG0 in the physical block BK0 corresponding to CH0 and CE1 is selected to be grouped into the virtual page VPG0; then, as shown by arrow A53, the physical page PG0 in the physical block BK0 corresponding to CH1 and CE0 is selected to be grouped into the virtual page VPG0; then, as shown by arrow A54, the physical page PG0 in the physical block BK0 corresponding to CH1 and CE1 is selected to be grouped into the virtual page VPG0. Grouped into virtual page VPG0; then, as shown by arrow A55, select the physical page PG0 in the physical block BK0 corresponding to CH2, CE0 to be grouped into virtual page VPG0; then, as shown by arrow A56, select the physical page PG0 in the physical block BK0 corresponding to CH2, CE1 to be grouped into virtual page VPG0; then, as shown by arrow A57, select the physical page PG0 in the physical block BK0 corresponding to CH3, CE0 to be grouped into virtual page VPG0; then, as shown by arrow A58, select the physical page PG0 in the physical block BK0 corresponding to CH0, CE1 to be grouped into virtual page VPG0.
[0112] Similarly, the memory controller 210 obtains the next virtual page VPG1 , for example, as shown in the order of arrows A59 - 1 and A59 - 2 , the memory controller 210 still first selects the next physical page PG1 from the physical channel CH0 to group it into the virtual page VPG1 .
[0113] Figure 6 FIG. 1 is a schematic diagram showing the creation of a virtual block and a virtual page according to another embodiment of the present invention. Figure 6 In this embodiment, the memory controller 210 first sorts the multiple physical pages with the same physical page number of each virtual page according to the corresponding chip enable pin number and then according to the corresponding physical channel number.
[0114] Since the sorting / grouping is first performed according to the corresponding chip enable pin number, the memory controller 210 will first sort / group in the order of CE pins CH0 and CE1, and then in the order of the corresponding multiple CH pins CH0~CH3. For example, in order to form a virtual page VPG0, as shown by arrow A61, the memory controller 210 first selects the physical page PG0 in the physical block BK0 corresponding to CH0 and CE0 to be grouped into the virtual page VPG0; then, as shown by arrow A62, the physical page PG0 in the physical block BK0 corresponding to CH1 and CE0 is selected to be grouped into the virtual page VPG0; then, as shown by arrow A63, the physical page PG0 in the physical block BK0 corresponding to CH2 and CE0 is selected to be grouped into the virtual page VPG0; then, as shown by arrow A64, the physical page PG0 in the physical block BK0 corresponding to CH3 and CE0 is selected to be grouped into the virtual page VPG0. Next, as shown by arrow A65, the physical page PG0 in the physical block BK0 corresponding to CH0 and CE1 is selected to be grouped into the virtual page VPG0; next, as shown by arrow A66, the physical page PG0 in the physical block BK0 corresponding to CH1 and CE1 is selected to be grouped into the virtual page VPG0; next, as shown by arrow A67, the physical page PG0 in the physical block BK0 corresponding to CH2 and CE1 is selected to be grouped into the virtual page VPG0; next, as shown by arrow A68, the physical page PG0 in the physical block BK0 corresponding to CH3 and CE1 is selected to be grouped into the virtual page VPG0.
[0115] Similarly, the memory controller 210 obtains the next virtual page VPG1. For example, as shown in the order of arrows A69-1, A69-2, A69-3, and A69-4, the memory controller 210 still first selects the next physical page PG1 from the CE pin CE0 to group it into the virtual page VPG1.
[0116] In one embodiment, the memory controller 210 writes data to each virtual physical block via a multi-plane write mechanism, and reads data from each virtual physical block via a multi-plane read mechanism. For example, the memory controller 210 may write data of 4 physical pages in size to each virtual physical block via a multi-plane write operation. Figure 5 The 1st, 3rd, 5th, and 7th physical pages PG0 in the virtual page VPG0 correspond to the same CE pin CE0 of different CH pins, thereby accelerating the speed of the write operation and improving the efficiency.
[0117] For another example, the memory controller 210 may write write data of 4 physical pages in size to the memory through a multi-plane write operation. Figure 6The 1st to 4th physical pages PG0 in the virtual page VPG0 in the memory controller 210 correspond to the same CE pin CE0 of different CH pins. In this example, the order in which the memory controller 210 writes data to the multiple physical pages PG0 of the virtual page VPG0 can be sequential and a multi-plane writing mechanism is used, thereby taking into account a high writing speed and not wasting any storage space.
[0118] In one embodiment, obtaining the plurality of virtual blocks to perform the host write operation includes: selecting one or more target virtual blocks from the plurality of virtual blocks to store write data corresponding to a write instruction; and recording address mapping information of the logical address and the physical address of the write data according to the physical address of one or more target virtual pages of the one or more target virtual blocks and the logical address of the write data, wherein the write instruction indicates the logical address and the write data is stored in the one or more target virtual pages. Figure 7~Figure 9 To illustrate a method for recording various address mapping information.
[0119] Figure 7 FIG. 1 is a schematic diagram of updating a logical-to-physical mapping table according to a virtual block according to an embodiment of the present invention. Figure 7 In this embodiment, it is assumed that the write data has been stored in the virtual page VPG0, and the logical addresses (indexes) corresponding to the write data are LBA1, LBA2~LBA8, and the physical addresses (indexes) of the physical pages for storing the corresponding write data are "CH0_CE0_BK0_PG0" (e.g., corresponding to the physical channel CH0, the physical block BK0 of the chip enable pin CE0, and the physical page PG0 therein), "CH0_CE1_BK0_PG0"~"CH3_CE1_BK0_PG0". It should be noted that the logical addresses (indexes) (e.g., the logical address "LBA1") and the physical addresses (indexes) (e.g., the physical address "CH0_CE0_BK0_PG0") used in the present disclosure are designed for the convenience of explanation, and do not limit the specific numerical contents of the logical addresses or physical addresses of the present disclosure.
[0120] In one embodiment, the memory controller 210 records / updates the physical address and the logical address of the write data into the logical-to-physical mapping table T71 .
[0121] In one embodiment, the memory controller 210 uses an additionally generated logical-to-virtual mapping table and a virtual-to-physical mapping table to record the mapping relationship between the virtual address (also called virtual index) of the virtual block used to store the written data, the logical address, and the physical address according to the characteristics of the virtual block. It should be noted that the virtual address refers to the index corresponding to each virtual block and virtual page in an abstract concept.
[0122] Figure 8 FIG. 1 is a schematic diagram showing updating a logical-to-virtual mapping table and a virtual-to-physical mapping table according to a virtual block according to an embodiment of the present invention. Figure 8 In this embodiment, it is assumed that the write data is stored in the virtual page VPG0 of the virtual block VBK0, the logical address (index) of the write data is LBA1, and the physical address (index) of the first physical page of the virtual page VPG0 is "CH0_CE0_BK0_PG0". In this example, after the write data is stored in the virtual page VPG0 of the virtual block VBK0, the memory controller 210 records / updates the logical address "LBA1" and the virtual address "VBK0_VPG0" of the corresponding write data to the logical-to-virtual mapping table T81, and records / updates the virtual address "VBK0_VPG0" and the physical address "CH0_CE0_BK0_PG0" of the corresponding write data to the virtual-to-physical mapping table T82. It should be noted that in this embodiment, the virtual address of the corresponding write data is recorded with the information corresponding to the entire virtual page.
[0123] Thus, when the memory controller 210 performs a data read operation to read the data, the memory controller 210 can use the logical-to-virtual mapping table T81 and the virtual-to-physical mapping table T82 to read the data from the physical address “CH0_CE0_BK0_PG0” of the corresponding virtual page VPG02 according to the logical address “LBA1”.
[0124] It is worth mentioning that, in other embodiments, the memory controller 210 uses the sequence information of each physical page in a virtual page to record the virtual address of the corresponding write data.
[0125] Fig. 9 FIG. 1 is a schematic diagram showing updating a logical-to-virtual mapping table and a virtual-to-physical mapping table according to a virtual block according to another embodiment of the present invention. Fig. 9 As shown above, the memory controller 210 assigns a virtual address to each physical page according to the order of each physical page in the virtual page VPG0. For example, the virtual address of the first physical page PG0 in the virtual page VPG0 is set to "VBK0_VPG0_1".
[0126] Furthermore, it is assumed that a plurality of written data are stored in the virtual page VPG0 of the virtual block VBK0, the logical addresses are respectively “LBA1”, “LBA2”, . . . , and the plurality of virtual addresses of the virtual page VPG0 are “VBK0_VPG0_1”, “VBK0_VPG0_1”, . . .
[0127] In this example, after storing multiple write data in the virtual page VPG0 of the virtual block VBK0, the memory controller 210 will record / update the logical addresses "LBA1", "LBA2" ... and virtual addresses "VBK0_VPG0_1", "VBK0_VPG0_1", ... of the corresponding write data to the logical-to-virtual mapping table T91, and will record / update the virtual addresses "VBK0_VPG0_1", "VBK0_VPG0_1", ... and physical addresses "CH0_CE0_BK0_PG0", "CH0_CE1_BK0_PG0", ... of the corresponding write data to the virtual-to-physical mapping table T92. It is worth mentioning that since the granularity of the virtual address is equal to the granularity of the physical address, the space utilization efficiency of this embodiment will be higher (compared to Figure 8 for example).
[0128] For example, if the memory controller 210 performs a data read operation to read data stored at the logical address "LBA2", the memory controller 210 can use the logical-to-virtual mapping table T91 to find the corresponding virtual address "VBK0_VPG0_2". Then, using the virtual-to-physical mapping table T92, the memory controller 210 can find the corresponding physical address "CH0_CE1_BK0_PG0" according to the virtual address "VBK0_VPG0_2" to read the data.
[0129] Please come back Figure 2 After completing the first virtual block mapping operation, the memory controller 210 determines whether the number of blank physical blocks of each of the plurality of physical channels is lower than a predetermined threshold.
[0130] For example, in step S220, when the number of blank physical blocks of a target physical channel (also called target channel pins) among the multiple physical channels is lower than a predetermined threshold, the multiple physical channels are divided into a first physical channel group and a second physical channel group, wherein the first physical channel group at least includes the target physical channel.
[0131] Specifically, if the number of blank physical blocks (the total number of blank / available physical blocks) of a target physical channel among the multiple physical channels is lower than the predetermined threshold, the memory controller 210 determines that the target physical channel needs to perform a garbage collection operation.
[0132] However, in order to prevent the rewritable non-volatile memory module 220 from delaying the execution of the garbage collection operation due to processing the data write command from the host system 10 .
[0133] In this embodiment, the memory controller 210 groups the multiple memory chips of the rewritable non-volatile memory module 220, allowing one group to perform a garbage collection operation, while allowing the other group to remain in a normal operating state to process data write instructions from the host system. In this way, even if the garbage collection operation is currently being performed on the first group of memory chips, when a data write instruction is received from the host system 10, the memory controller 210 can use the second group of memory chips to store the write data corresponding to the received data write instruction. In addition, after the first group of memory chips has completed the garbage collection operation, the second group of memory chips can be used to perform the garbage collection operation, and the first group of memory chips can be used to receive the data write instruction from the host system 10 to store the write data corresponding to the received data write instruction.
[0134] For example, in step S230, the memory controller 210 releases the first virtual block mapping operation performed on the multiple physical channels and the multiple physical blocks corresponding to each memory chip, and respectively performs the second virtual block mapping operation on the multiple first physical blocks corresponding to the first physical channel group and the multiple second physical blocks corresponding to the second physical channel group to obtain the multiple first virtual blocks corresponding to the first physical channel group and the multiple second virtual blocks corresponding to the second physical channel group. Then, in step S240, the memory controller 210 performs a garbage collection operation on the multiple first virtual blocks corresponding to the first physical channel group, and performs a host write operation on the multiple second virtual blocks corresponding to the second physical channel group.
[0135] More specifically, the memory controller 210 divides the plurality of physical channels into a first physical channel group and a second physical channel group, wherein the first physical channel group at least includes a target physical channel corresponding to the target physical channel. The memory controller 210 first performs a garbage collection operation on the first physical channel group having the target physical channel. In one embodiment, the number of blank physical blocks of each of the plurality of physical channels of the first physical channel group is less than the number of blank physical blocks of each of the plurality of physical channels of the second physical channel group.
[0136] If the first virtual block mapping operation performed by the multiple physical areas corresponding to the multiple physical channels and the multiple chip enable pins has been completed, the memory controller 210 first releases the first virtual block mapping operation (eg, does not use the obtained multiple virtual blocks to access data).
[0137] Next, the memory controller 210 performs a second virtual block mapping operation on the plurality of first physical blocks corresponding to the first physical channel group and the plurality of second physical blocks corresponding to the second physical channel group, respectively, to obtain the plurality of first virtual blocks corresponding to the first physical channel group and the plurality of second virtual blocks corresponding to the second physical channel group. In one embodiment, performing the second virtual block mapping operation on the plurality of first physical blocks corresponding to the first physical channel group and the plurality of second physical blocks corresponding to the second physical channel group, respectively, includes: grouping the plurality of first physical blocks into the plurality of first virtual blocks corresponding to the first physical channel group according to at least one second physical channel in the first physical channel group, a plurality of first chip enable pins corresponding to each second physical channel, and the first physical block numbers of the plurality of first physical blocks corresponding to each first chip enable pin; and mapping the plurality of first physical pages grouped into each first virtual block according to the first physical block numbers of the plurality of first physical pages grouped into each first virtual block. According to the physical page numbering, the multiple first physical pages are regrouped into the multiple first virtual pages of the first virtual block to which they belong; according to the second physical block numbers of each of the multiple second physical blocks corresponding to each of the at least one second physical channel in the second physical channel group, the multiple second chip enable pins of each of the corresponding second physical channels, and the multiple second physical blocks corresponding to each of the second chip enable pins, the multiple second physical blocks are grouped into the multiple second virtual blocks of the corresponding second physical channel group; and according to the second physical page numbers of each of the multiple second physical pages grouped into each of the second virtual blocks, the multiple second physical pages are regrouped into the multiple second virtual pages of the second virtual block to which they belong.
[0138] Next, the processor locks the plurality of first virtual blocks corresponding to the first physical channel group to perform garbage collection operations on the plurality of first virtual blocks, wherein the plurality of second virtual blocks corresponding to the second physical channel group maintain normal operation.
[0139] In this way, the bandwidth of the four channels can be fully utilized, the utilization efficiency of dirty disks can be improved, and the conflict between host data writing and garbage collection operations can be avoided.
[0140] In one embodiment, performing a second virtual block mapping operation on a plurality of first physical blocks corresponding to the first physical channel group and a plurality of second physical blocks corresponding to the second physical channel group, respectively, includes: performing a virtual block mapping operation on a second type of physical blocks among the plurality of first physical blocks corresponding to the first physical channel group, wherein the second type of physical blocks belong to a multi-level storage unit type; and performing a virtual block mapping operation on a first type of physical blocks among the plurality of second physical blocks corresponding to the second physical channel group, wherein the first type of physical blocks belong to a single-level storage unit type.
[0141] In simple terms, for the physical channel group used to process the host write operation, the memory controller 210 will select the physical block of the single-level storage cell type to perform the virtual block mapping operation; for the physical channel group used to process the garbage collection operation, the memory controller 210 will select the physical block of the multi-level storage cell type to perform the virtual block mapping operation. The reason is that in order to efficiently process the host write operation, the fastest virtual block corresponding to multiple single-level storage cell types will be used to write data; in order to efficiently process the host write operation, the virtual block corresponding to multiple multi-level storage cell types with more invalid data will be used to move data through the multi-plane read and write mechanism.
[0142] Fig.10 Schematic diagram of performing virtual block mapping operations based on garbage collection operations and normal operations according to an embodiment of the present invention. Figure 3 and Fig.10 For example, based on Figure 3 In the architecture, it is assumed that the target physical channel that needs to perform the garbage collection operation is located in the memory chip DI00, which corresponds to the CH pin CH0 and the CE pin CE0. The memory controller 210 groups the CH pins CH0 and CH1 into a first CH pin group to perform the garbage collection operation; and groups the CH pins CH2 and CH3 into a second CH pin group to maintain normal operation.
[0143] Next, the memory controller 210 performs a second virtual block mapping operation on the first CH pin group and the second CH pin group respectively. The difference between the second virtual block mapping operation and the first virtual block mapping operation is that the second virtual block mapping operation constructs virtual blocks for physical blocks belonging to each group.
[0144] For example, as shown by arrows A101 to A104, the memory controller 210 performs the second virtual block mapping operation on the first physical channel group (first channel pin group): the memory controller 210 first selects the first physical page PG0 of the physical block BK0 corresponding to CH0 and CE0; the first physical page PG0 of the physical block BK0 corresponding to CH0 and CE1; the first physical page PG0 of the first physical page PG0 of the physical block BK0 corresponding to CH1 and CE0; the first physical page PG0 of the physical block BK0 corresponding to CH1 and CE1, and groups the selected 4 physical pages into the first virtual page VPG10 of the virtual block VBK10 corresponding to the first CH pin group. By analogy, multiple virtual blocks corresponding to the first CH pin group can be obtained to perform garbage collection operations on multiple virtual blocks stored in the corresponding first CH pin group.
[0145] At this time, the memory controller 210 will perform garbage collection operations on the first CH pin group (garbage collection group) in units of virtual blocks, read valid data from multiple source virtual blocks in the first CH pin group, and write them to blank (available) virtual blocks in the first CH pin group.
[0146] On the other hand, as shown by arrows A105-A108, the memory controller 210 performs a second virtual block mapping operation on the second physical channel group (second channel pin group): the memory controller 210 selects the first physical page PG0 of the physical block BK0 corresponding to CH2 and CE0; the first physical page PG0 of the physical block BK0 corresponding to CH2 and CE1; the first physical page PG0 of the first physical page PG0 of the physical block BK0 corresponding to CH3 and CE0; the first physical page PG0 of the physical block BK0 corresponding to CH3 and CE1, and groups the selected 4 physical pages into the first virtual page VPG20 of the virtual block VBK20 corresponding to the second CH pin group. By analogy, multiple virtual blocks corresponding to the second CH pin group can be obtained so that the write instruction from the host system can be executed normally.
[0147] That is, during the period when the garbage collection operation is performed on the plurality of target physical blocks corresponding to the first physical channel group, if another write instruction is received from the host system 10, the memory controller 210 performs another write operation to select one or more target second virtual blocks from the plurality of second virtual blocks to store another write data corresponding to the another write instruction. For example, during the period when the garbage collection operation is performed on the virtual block VBK10, the memory controller 210 can still select the blank (available) virtual block VBK20 to store another write data without stopping the garbage collection operation being performed.
[0148] After storing the other write data, the memory controller 210 records the address mapping information of the logical address and the physical address of the other write data according to the physical addresses of the one or more target second virtual pages of the one or more target second virtual blocks for storing the other write data corresponding to the other write instruction and the logical address of the other write data. The method of recording the address mapping information has been described in detail above and will not be repeated here.
[0149] In one embodiment, after the garbage collection operation of the plurality of first physical blocks corresponding to the first physical channel group is completed, the memory controller 210 may release the second virtual block mapping operation corresponding to the first physical channel group and the second physical channel group, and restore the first virtual block mapping operation so that all physical channels can be used to perform a host system write operation.
[0150] In one embodiment, after the garbage collection operation of the first physical blocks corresponding to the first physical channel group is completed, the memory controller 210 can further restore the first physical channel group after the garbage collection operation to normal operation to wait for the host write operation.
[0151] For example, the memory controller 210 performs the other host write operation on the multiple first virtual blocks of the first physical channel group, including: performing a virtual block mapping operation on a first type of physical blocks among the multiple first physical blocks corresponding to the first physical channel group to obtain the multiple first virtual blocks, thereby performing the other host write operation on the multiple first virtual blocks, wherein the first type of physical blocks belong to a single-level storage unit type.
[0152] In one embodiment, after the garbage collection operation of the first physical blocks corresponding to the first physical channel group is completed, the memory controller 210 can further perform a garbage collection operation on the second physical channel group. Specifically, the memory controller 210 restores the normal operation of the first physical blocks corresponding to the first physical channel group; and the memory controller 210 performs another garbage collection operation on the second virtual blocks of the second physical channel group.
[0153] For example, the memory controller 210 performs the other garbage collection operation on the multiple second virtual blocks of the second physical channel group, including: performing a virtual block mapping operation on a second type of physical blocks among the multiple second physical blocks corresponding to the second physical channel group to obtain the multiple second virtual blocks, thereby performing the other garbage collection operation on the multiple second virtual blocks, wherein the second type of physical blocks belong to a multi-level storage unit type.
[0154] In one embodiment, after the another garbage collection operation of the multiple second physical blocks corresponding to the second physical channel group is completed, the memory controller 210 restores the normal operation of the multiple second physical blocks corresponding to the second physical channel group, releases the second virtual block mapping operation, and restores the first virtual block mapping operation.
[0155] In one embodiment, during the execution of the first virtual block mapping operation on the first type of physical blocks among the plurality of physical blocks, the memory controller 210 selects predetermined physical blocks from each physical channel to execute a third virtual block mapping operation, so as to group the plurality of predetermined physical blocks into a plurality of predetermined virtual blocks for storing system data.
[0156] Since the system data volume is small, although binding all CH pins and CE pins (such as the first virtual block mapping operation) improves the transmission efficiency, the storage utilization rate is reduced and the storage space is wasted. Therefore, in this embodiment, the memory controller 210 uses a specific range of physical blocks for binding to store system data exclusively.
[0157] In detail, the memory controller 210 performs a third virtual block mapping operation on a plurality of predetermined physical blocks corresponding to the plurality of physical channels and predetermined chip enable pins among the plurality of chip enable pins to group the plurality of predetermined physical blocks into a plurality of predetermined virtual blocks, wherein the plurality of predetermined virtual blocks are used to store system data.
[0158] When executing a system data storage instruction sequence, the processor performs a system data write operation to select one or more target predetermined virtual blocks from the plurality of predetermined virtual blocks, and stores system data of the corresponding system data storage instruction sequence to the selected one or more target predetermined virtual blocks, wherein the system data is not user data from the host system.
[0159] In one embodiment, the plurality of predetermined physical blocks are of a multi-level memory cell type.
[0160] Fig.11 FIG. 1 is a schematic diagram of performing virtual block mapping operations based on system data storage requirements according to an embodiment of the present invention. For example, please refer to Fig.11 In this embodiment, it is assumed that the memory controller 210 sets the first CE pin CE0 of each CH pin as a predetermined chip enable pin. Multiple physical blocks configured in the predetermined chip enable pin CE0 are used as predetermined physical blocks. For example, as shown by arrows A111~A114, the physical page PG0 corresponding to CH0, CE0, and BK0 is grouped into the virtual page VPG0 in the predetermined virtual block VBK0; the physical page PG0 corresponding to CH1, CE0, and BK0 is grouped into the virtual page VPG0 in the predetermined virtual block VBK0; the physical page PG0 corresponding to CH2, CE0, and BK0 is grouped into the virtual page VPG0 in the predetermined virtual block VBK0; the physical page PG0 corresponding to CH3, CE0, and BK0 is grouped into the virtual page VPG0 in the predetermined virtual block VBK0. And so on, through the third virtual block mapping operation, the memory controller 210 obtains multiple predetermined virtual blocks to store system data in these predetermined virtual blocks.
[0161] Thus, although the number of the plurality of predetermined virtual blocks obtained through the third virtual block mapping operation is less than that of the first virtual block mapping operation, it is sufficient for the system data of smaller size to be used. The system data may include any type of data other than user data for managing the operation of the storage device, such as various address mapping tables, bad block tables for garbage collection operations, pruning tables, etc.
[0162] Based on the above, the memory controller, storage device and memory management method provided by the embodiments of the present invention can utilize the method of grouping and binding multiple physical blocks to obtain multiple groups of virtual blocks, so that the storage device can perform garbage collection operations and host user data writing operations in groups at the same time, avoiding the defect that traditional garbage collection operations need to avoid host user data writing operations, and enhancing the execution flexibility and efficiency of garbage collection operations, thereby improving the working efficiency of the storage device and enhancing the user experience.
[0163] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A memory management method for a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module comprises a plurality of physical channels each corresponding to a plurality of memory chips, each of the memory chips comprises a plurality of physical blocks arranged in sequence according to a plurality of physical block numbers, characterized in that: include: Performing a first virtual block mapping operation on the plurality of physical blocks of the plurality of memory chips corresponding to the plurality of physical channels to obtain a plurality of virtual blocks for performing a host write operation; When the number of blank physical blocks of a target physical channel among the plurality of physical channels is lower than a predetermined threshold, dividing the plurality of physical channels into a first physical channel group and a second physical channel group, wherein the first physical channel group at least includes the target physical channel; as well as Release the first virtual block mapping operation performed on the plurality of physical channels and the plurality of physical blocks corresponding to each memory chip, and perform a second virtual block mapping operation on the plurality of first physical blocks corresponding to the first physical channel group and the plurality of second physical blocks corresponding to the second physical channel group, respectively, to obtain a plurality of first virtual blocks corresponding to the first physical channel group and a plurality of second virtual blocks corresponding to the second physical channel group; in According to the physical block numbers of the physical blocks corresponding to each memory chip in the first physical channel group and the second physical channel group, the physical blocks having the same physical block number are grouped into the same virtual block; as well as A garbage collection operation is performed on the plurality of first virtual blocks corresponding to the first physical channel group, and a host write operation is performed on the plurality of second virtual blocks corresponding to the second physical channel group.
2. The memory management method according to claim 1, characterized in that: Performing the first virtual block mapping operation on the plurality of physical blocks of the plurality of memory chips corresponding to the plurality of physical channels includes: A virtual block mapping operation is performed on a plurality of first-type physical blocks among the plurality of physical blocks, wherein the plurality of first-type physical blocks belong to a single-level storage unit type.
3. The memory management method according to claim 2, characterized in that: Obtaining the plurality of virtual blocks to perform the host write operation includes: Selecting one or more target virtual blocks from the plurality of virtual blocks to store write data corresponding to a write command; and According to the physical addresses of one or more target virtual pages of the one or more target virtual blocks and the logical addresses of the corresponding write data, address mapping information of the logical addresses and the physical addresses of the corresponding write data is recorded, wherein the write instruction indicates the logical address, and the write data is stored in the one or more target virtual pages.
4. The memory management method according to claim 1, characterized in that: Performing a second virtual block mapping operation on a plurality of first physical blocks corresponding to the first physical channel group and a plurality of second physical blocks corresponding to the second physical channel group respectively includes: performing a virtual block mapping operation on a second type of physical block among a plurality of first physical blocks corresponding to the first physical channel group, wherein the second type of physical block belongs to a multi-level memory cell type; and A virtual block mapping operation is performed on a first type of physical block among a plurality of second physical blocks corresponding to the second physical channel group, wherein the first type of physical block belongs to a single-level memory cell type.
5. The memory management method according to claim 4, characterized in that: During the garbage collection operation performed on a plurality of first physical blocks corresponding to the first physical channel group, If another write instruction is received, selecting one or more target second virtual blocks from the plurality of second virtual blocks to store another write data corresponding to the another write instruction; as well as According to the physical addresses of one or more target second virtual pages of the one or more target second virtual blocks and the corresponding logical addresses of the other write data, the address mapping information of the logical address and the physical address of the other write data corresponding to the other write instruction is recorded, wherein the write instruction indicates the logical address of the other write data corresponding to the one or more target second virtual pages, and the write data is stored in the one or more target second virtual pages.
6. The memory management method according to claim 1, characterized in that: After the garbage collection operation of the plurality of first physical blocks corresponding to the first physical channel group is completed, the method further includes: Restoring normal operation of the plurality of first physical blocks corresponding to the first physical channel group, and performing another host write operation on the plurality of first virtual blocks of the first physical channel group; and performing another garbage collection operation on the plurality of second virtual blocks of the second physical channel group; After the another garbage collection operation of the plurality of second physical blocks corresponding to the second physical channel group is completed, normal operation of the plurality of second physical blocks corresponding to the second physical channel group is restored, the second virtual block mapping operation is released, and the first virtual block mapping operation is restored.
7. The memory management method according to claim 6, characterized in that: Performing the another host write operation on the plurality of first virtual blocks of the first physical channel group includes: performing a virtual block mapping operation on a first type of physical blocks among a plurality of first physical blocks corresponding to the first physical channel group to obtain the plurality of first virtual blocks, thereby performing the another host write operation on the plurality of first virtual blocks, wherein the first type of physical blocks belong to a single-level storage unit type; Performing the another garbage collection operation on the plurality of second virtual blocks of the second physical channel group includes: A virtual block mapping operation is performed on a second type of physical blocks among a plurality of second physical blocks corresponding to the second physical channel group to obtain the plurality of second virtual blocks, thereby performing the another garbage collection operation on the plurality of second virtual blocks, wherein the second type of physical blocks belong to a multi-level storage unit type.
8. The memory management method according to claim 1, characterized in that: The virtual block mapping operation includes: According to the physical page numbers of the physical pages of the physical blocks grouped into each virtual block, the physical pages having the same physical page number are regrouped into the same virtual page of the corresponding virtual block.
9. The memory management method according to claim 2, characterized in that: During the execution of a first virtual block mapping operation on a first type of physical block among the plurality of physical blocks, the method further comprises: Selecting predetermined physical blocks from each physical channel to perform a third virtual block mapping operation to group a plurality of predetermined physical blocks into a plurality of predetermined virtual blocks, wherein the plurality of predetermined physical blocks belong to a multi-level storage unit type; and When the system data storage instruction sequence is executed, one or more target predetermined virtual blocks are selected from the plurality of predetermined virtual blocks, and corresponding system data are stored in the selected one or more target predetermined virtual blocks, wherein the system data is not user data from the host system.
10. The memory management method according to claim 9, characterized in that: Each of the memory chips comprises a plurality of planes, and the method further comprises: Data is written to each virtual physical block via a multi-plane write mechanism, and data is read from each virtual physical block via a multi-plane read mechanism.
11. A memory controller for controlling a storage device equipped with a rewritable non-volatile memory module, characterized in that: The memory controller comprises: a memory interface control circuit electrically connected to the rewritable non-volatile memory module, wherein the rewritable non-volatile memory module comprises a plurality of physical channels respectively corresponding to a plurality of memory chips, each of the memory chips comprises a plurality of physical blocks arranged in sequence according to a plurality of physical block numbers; and A processor electrically connected to the memory interface control circuit, wherein the processor is further electrically connected to the connection interface circuit of the storage device to electrically connect to the host system, wherein the processor is configured to: Performing a first virtual block mapping operation on the plurality of physical blocks of the plurality of memory chips corresponding to the plurality of physical channels to obtain a plurality of virtual blocks for performing a host write operation; When the number of blank physical blocks of a target physical channel among the plurality of physical channels is lower than a predetermined threshold, dividing the plurality of physical channels into a first physical channel group and a second physical channel group, wherein the first physical channel group at least includes the target physical channel; and The first virtual block mapping operation performed on the plurality of physical channels and the plurality of physical blocks corresponding to each memory chip is released, and a second virtual block mapping operation is performed on the plurality of first physical blocks corresponding to the first physical channel group and the plurality of second physical blocks corresponding to the second physical channel group, respectively, to obtain a plurality of first virtual blocks corresponding to the first physical channel group and a plurality of second virtual blocks corresponding to the second physical channel group; wherein According to the physical block numbers of the physical blocks corresponding to each memory chip in the first physical channel group and the second physical channel group, the physical blocks having the same physical block number are grouped into the same virtual block; and A garbage collection operation is performed on the plurality of first virtual blocks corresponding to the first physical channel group, and a host write operation is performed on the plurality of second virtual blocks corresponding to the second physical channel group.
12. The memory controller according to claim 11, wherein: Performing the first virtual block mapping operation on the plurality of physical blocks of the plurality of memory chips corresponding to the plurality of physical channels includes: The processor performs a virtual block mapping operation on a plurality of first-type physical blocks among the plurality of physical blocks, wherein the plurality of first-type physical blocks belong to a single-level storage unit type.
13. The memory controller according to claim 12, wherein: Obtaining the plurality of virtual blocks to perform the host write operation includes: The processor selects one or more target virtual blocks from the plurality of virtual blocks to store write data corresponding to a write instruction; and The processor records the address mapping information of the logical address and the physical address of the corresponding write data according to the physical address of one or more target virtual pages of the one or more target virtual blocks and the logical address of the corresponding write data, wherein the write instruction indicates the logical address, and the write data is stored in the one or more target virtual pages.
14. The memory controller according to claim 11, wherein: Performing a second virtual block mapping operation on a plurality of first physical blocks corresponding to the first physical channel group and a plurality of second physical blocks corresponding to the second physical channel group respectively includes: The processor performs a virtual block mapping operation on a second type of physical block among a plurality of first physical blocks corresponding to the first physical channel group, wherein the second type of physical block belongs to a multi-level storage unit type; and The processor performs a virtual block mapping operation on a first type of physical block among a plurality of second physical blocks corresponding to the second physical channel group, wherein the first type of physical block belongs to a single-level memory cell type.
15. The memory controller according to claim 14, wherein: During the garbage collection operation on the plurality of first physical blocks corresponding to the first physical channel group, If another write instruction is received, the processor selects one or more target second virtual blocks from the plurality of second virtual blocks to store another write data corresponding to the another write instruction; as well as The processor records the address mapping information of the logical address and the physical address of the other write data corresponding to the other write instruction according to the physical address of one or more target second virtual pages of the one or more target second virtual blocks and the logical address of the corresponding other write data, wherein the write instruction indicates the logical address of the corresponding other write data, and the write data is stored in the one or more target second virtual pages.
16. The memory controller according to claim 11, wherein: After the garbage collection operation of the plurality of first physical blocks corresponding to the first physical channel group is completed, the processor is further configured to: Restoring normal operation of the plurality of first physical blocks corresponding to the first physical channel group, and performing another host write operation on the plurality of first virtual blocks of the first physical channel group; as well as performing another garbage collection operation on the plurality of second virtual blocks of the second physical channel group; After the another garbage collection operation of the plurality of second physical blocks corresponding to the second physical channel group is completed, the processor restores the normal operation of the plurality of second physical blocks corresponding to the second physical channel group, releases the second virtual block mapping operation, and restores the first virtual block mapping operation.
17. The memory controller according to claim 16, wherein: Performing the another host write operation on the plurality of first virtual blocks of the first physical channel group includes: The processor performs a virtual block mapping operation on a first type of physical blocks among a plurality of first physical blocks corresponding to the first physical channel group to obtain the plurality of first virtual blocks, thereby performing the another host write operation on the plurality of first virtual blocks, wherein the first type of physical blocks are of a single-level storage unit type; Performing the another garbage collection operation on the plurality of second virtual blocks of the second physical channel group includes: The processor performs a virtual block mapping operation on a second type of physical blocks among a plurality of second physical blocks corresponding to the second physical channel group to obtain the plurality of second virtual blocks, thereby performing the another garbage collection operation on the plurality of second virtual blocks, wherein the second type of physical blocks belongs to a multi-level storage unit type.
18. The memory controller according to claim 11, wherein: The virtual block mapping operation includes: The processor regroups the physical pages having the same physical page number into a same virtual page of the corresponding virtual block according to the physical page numbers of the physical pages of the physical blocks grouped into each virtual block.
19. The memory controller according to claim 12, wherein: During the period of performing a first virtual block mapping operation on a first type of physical block among the plurality of physical blocks, The processor selects predetermined physical blocks from each physical channel to perform a third virtual block mapping operation to group a plurality of predetermined physical blocks into a plurality of predetermined virtual blocks, wherein the plurality of predetermined physical blocks belong to a multi-level storage unit type; as well as When the system data storage instruction sequence is executed, one or more target predetermined virtual blocks are selected from the plurality of predetermined virtual blocks, and corresponding system data is stored in the selected one or more target predetermined virtual blocks, wherein the system data is not user data from the host system.
20. The memory controller according to claim 19, wherein: Each of the memory chips comprises a plurality of planes, wherein The processor writes data to each virtual physical block via a multi-plane write mechanism and reads data from each virtual physical block via a multi-plane read mechanism.
