Data storage device and method for updating logical to physical address mapping table
By dividing multiple logical units in the NAND flash memory and writing super page data in segments, the problem of logical to physical address mapping table update performance is solved, the write performance of the data storage device is improved, and the performance of the write command is avoided. loss.
Patent Information
- Application Number
- CN201910402944.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-05-15
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2040-03-22
AI Technical Summary
As the capacity of NAND flash memory increases, the controller needs to completely record the logical to physical address mapping table, resulting in a large demand for dynamic random access memory capacity and increased cost. In addition, the traditional method will interrupt the writing of the super page when writing instructions. The interleaving mechanism causes write performance loss.
By dividing the flash memory into multiple logical units in the data storage device, and using the memory controller to compose multiple page data of the write instructions into super page data, write them into these logical units in segments, and after the writing is completed Update the group mapping table to avoid interrupting the write interleaving mechanism and improve write performance.
This achieves efficient updating of the logical to physical address mapping table when the dynamic random access memory space is insufficient, thereby avoiding a decrease in writing performance and improving the writing performance of the data storage device.
Smart Images

Figure CN111813703B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a data storage device, and more particularly to a data storage device and a method for updating a logical-to-physical address mapping table. Background Art
[0002] Flash memory devices are usually divided into NOR flash devices and NAND flash devices. NOR flash devices are random access devices, and any address can be provided on the address pins to access the host device of the NOR flash device, and the data stored at the address can be obtained from the data pins of the NOR flash device in a timely manner. In contrast, NAND flash devices are not random access, but sequential access. NAND flash devices cannot access any random address like NOR flash devices. Instead, the host device needs to write a sequence of byte values into the NAND flash device to define the type of request command (such as read, write, erase, etc.) and the address used in this command. The address can point to a page (the smallest data block for a write operation in the flash memory) or a block (the smallest data block for an erase operation in the flash memory). In fact, NAND flash devices usually read or write complete pages of data from memory cells. After a full page of data is read from the array into a buffer in the device, the master unit can access the data byte by byte or word by word by using a strobe signal to clock out the contents sequentially.
[0003] However, as the capacity of NAND flash memory increases, if the dynamic random access memory on the controller side needs to fully record the entire logical to physical address mapping table of the NAND flash memory, the capacity requirement of the dynamic random access memory is also quite large, which will increase the cost. If a dynamic random access memory with a smaller capacity is used, the controller needs to frequently replace and update the group mapping table in the dynamic random access memory when executing a write instruction. However, the group mapping table required for the traditional data storage device to read the write instruction from the flash memory often interrupts the interleaving mechanism of the write instruction when writing the super page, resulting in a loss of write performance.
[0004] Therefore, a data storage device and a method for updating a logical-to-physical address mapping table are needed to solve the above problems. Summary of the invention
[0005] The present invention provides a data storage device. The data storage device includes: a flash memory, a dynamic random access memory, and a memory controller. The flash memory is used to store a logical to physical address mapping table, wherein the logical to physical address mapping table is divided into a plurality of group mapping tables, and the flash memory includes a first logical unit number and a second logical unit number respectively controlled by a first chip enable signal and a second chip enable signal. The dynamic random access memory is used to store a portion of these group mapping tables. The memory controller is used to receive a write instruction from a host, and to form a plurality of page data of the write instruction into a super page data. The memory controller sequentially enables the first chip enable signal and the second chip enable signal to write the super page data into the first logical unit number and the second logical unit number in segments. In response to the super page data having been written into the first logical unit number and the second logical unit number, the memory controller reads at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory.
[0006] In some embodiments, when a first chip enable signal is enabled to write a first segment of the super page data to a first logical unit number and a first read instruction corresponding to at least one group mapping table has been stored in a command queue, the memory controller waits for the first logical unit number to enter a programming phase, and then enables a second chip enable signal to write a second segment of the super page data to a second logical unit number; and in response to the super page data having been written to the first logical unit number and the second logical unit number, the memory controller executes a first read instruction to read at least one group mapping table from the first logical unit number or the second logical unit number to a dynamic random access memory.
[0007] In some embodiments, after executing the first read instruction to read at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory, the memory controller further updates at least one group mapping table according to the multiple logical addresses of the page data of the write instruction and the multiple physical addresses written to the first logical unit number and the second logical unit number, wherein the predetermined condition is that the number of the updated first group mapping tables in the dynamic random access memory reaches a predetermined number.
[0008] The present invention also provides a method for updating a logical-to-physical address mapping table for a data storage device, wherein the data storage device includes a flash memory and a dynamic random access memory, the flash memory is used to store a logical-to-physical address mapping table, wherein the logical-to-physical address mapping table is divided into a plurality of group mapping tables, wherein the flash memory includes a first logical unit number and a second logical unit number respectively controlled by a first chip enable signal and a second chip enable signal, the method comprising: forming a super page data from a plurality of page data of a write instruction from a host; sequentially enabling the first chip enable signal and the second chip enable signal to write the super page data segments to the first logical unit number and the second logical unit number; and in response to the super page data having been written to the first logical unit number and the second logical unit number, reading at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 is a block diagram showing an electronic system according to an embodiment of the present invention.
[0010] Figure 2 FIG. 4 is a block diagram of an access interface and a storage unit according to an embodiment of the present invention.
[0011] Figure 3 FIG. 4 is a schematic diagram of a connection between an access sub-interface and a plurality of LUNs according to an embodiment of the present invention.
[0012] Figure 4 FIG. 4 is a schematic diagram of a logical-to-physical address mapping table and a group mapping table according to an embodiment of the present invention.
[0013] Figure 5A FIG. 4 is a schematic diagram of an interleaving mechanism for a write operation of a flash memory according to an embodiment of the present invention.
[0014] Figure 5B and 5C FIG. 1 is a schematic diagram of adding a read operation to the interleaving mechanism of a write operation of a flash memory according to an embodiment of the present invention.
[0015] Figure 5D and 5E FIG. 2 is a schematic diagram of adding a read operation to the interleaving mechanism of a write operation of a flash memory according to another embodiment of the present invention.
[0016] Figure 6 is a flow chart showing a method for updating a logical-to-physical address mapping table according to an embodiment of the present invention.
[0017] Explanation of symbols
[0018] 100~Electronic system;
[0019] 120~Host;
[0020] 140~Data storage device;
[0021] 150~Access interface;
[0022] 160~Memory controller;
[0023] 162~Processing unit;
[0024] 163~Storage unit;
[0025] 164~Start the program;
[0026] 166~Static Random Access Memory;
[0027] 170~Access interface;
[0028] 180~Flash memory;
[0029] 181~Flash translation layer;
[0030] 190~Dynamic Random Access Memory;
[0031] 170_0-170_j~Access sub-interface;
[0032] 180_0_0-180_j_i~Logical unit number;
[0033] 320_0_0-320_0_i~Chip enable control signal;
[0034] 400 ~ logical to physical address mapping table;
[0035] 401~Group mapping table;
[0036] 420~first predetermined space;
[0037] 430~Second predetermined space;
[0038] t1~t18~time;
[0039] CE0-CE3~Chip enable signal;
[0040] CH0-CH3~channel;
[0041] T s ~Set the time;
[0042] T prog ~ Programming time;
[0043] T CMD ~ Loading time;
[0044] T DMA ~Transmission time;
[0045] SPD1_0-SP1_15、SPD2_0-SP2_15~page data;
[0046] Steps S510-S530, S610-S660. DETAILED DESCRIPTION
[0047] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, a preferred embodiment is given below and described in detail with reference to the accompanying drawings.
[0048] Figure 1 1 is a block diagram showing an electronic system according to an embodiment of the present invention. The electronic system 100 may be, for example, a personal computer, a data server, a network-attached storage (NAS), a portable electronic device, etc., but the present invention is not limited thereto. The portable electronic device may be, for example, a notebook computer, a handheld mobile phone, a smart phone, a tablet computer, a personal digital assistant (PDA), a digital camera, a digital video camera, a portable multimedia player, a personal navigation device, a handheld game console, an e-book, etc., but the present invention is not limited thereto.
[0049] The electronic system 100 includes a host 120 and a data storage device 140. The data storage device 140 includes a memory controller 160, a flash memory 180, and a dynamic random access memory 190. The memory controller 160 includes a processing unit 162, a storage unit 163, and a static random access memory (SRAM) 166. The processing unit 162 can be implemented in a variety of ways, such as a dedicated hardware circuit or a general hardware implementation (for example, a single processor, a multi-processor with parallel processing capabilities, or other processors with computing capabilities). The above implementation methods can be, for example, a general-purpose processor or a microcontroller, but the present invention is not limited thereto. In addition, the dynamic random access memory 190 is a non-essential component and can be replaced by a host memory buffer (HMB). In addition, generally speaking, the data storage space of the dynamic random access memory 190 is larger than that of the static random access memory 166.
[0050] The processing unit 162 in the memory controller 160 can operate according to the command issued by the host 120 to write data to a specified address in the flash memory 180 through the access interface 170 , or read data from a specified address (physical address) in the flash memory 180 .
[0051] The data and command transmission between the processing unit 162 and the flash memory 180 is coordinated through a number of electronic signals, including a data line, a clock signal, and a control signal. The data line can be used to transmit commands, addresses, read and write data; the control signal line can be used to transmit control signals such as chip enable (CE), address latch enable (ALE), command latch enable (CLE), write enable (WE), etc.
[0052] The access interface 170 may communicate with the flash memory 180 using a double data rate (DDR) communication protocol, such as an open NAND flash interface (ONFI), a double data rate switch (DDR toggle), or other interfaces. The processing unit 162 may also use the access interface 150 to communicate with the host 120 through a specified communication protocol, such as a universal serial bus (USB), advanced technology attachment (ATA), serial advanced technology attachment (SATA), peripheral component interconnect express (PCI-E), non-volatile memory express (NVMe), or other interfaces.
[0053] The storage unit 163 may be a non-volatile memory, such as a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or an electronic fuse (E-Fuse). The storage unit 163 stores a boot program 164, which includes a boot code or a boot program (Bootloader), and can be executed by the processing unit 162. The memory controller 160 completes the boot based on the boot program 164 and starts to control the operation of the flash memory 180, for example, reading the InSystem Programming (ISP) code.
[0054] The flash memory 180 is, for example, a NAND flash memory, and the flash memory 180 may be divided into a plurality of logic units, each of which has a corresponding logical unit number (LUN), and each of the logical units (LUNs) communicates with the processing unit 162 using an associated access sub-interface. In some embodiments, each LUN may include one or more flash memory dies or planes, and each plane includes a plurality of physical blocks.
[0055] Figure 2 1 is a block diagram of an access interface and a storage unit according to an embodiment of the present invention. The data storage device 140 may include j+1 access sub-interfaces 170_0 to 170_j, and the access sub-interface may also be called a channel. Each access sub-interface is connected to i+1 LUNs. In other words, i+1 LUNs share one access sub-interface. For example, when the data storage device 140 includes 4 channels (j=3) and each channel is connected to 4 storage units (i=3), the flash memory 180 has a total of 16 LUNs 180_0_0 to 180_j_i. The processing unit 162 may drive one of the access sub-interfaces 170_0 to 170_j to read data from a specified LUN. Each LUN has an independent chip enable (CE) control signal.
[0056] In other words, when data is to be read from a designated LUN, the associated access sub-interface needs to be driven to enable the chip enable control signal of the LUN. Figure 3 FIG. 1 is a schematic diagram of a connection between an access sub-interface and multiple LUNs according to an embodiment of the present invention. The processing unit 162 can use independent chip enable control signals 320_0_0 to 320_0_i to select one of the connected LUNs 180_0_0 to 180_0_i through the access sub-interface 170_0, and then read data from a specified position of the selected LUN through the shared data line 310_0.
[0057] The process of writing data into the flash memory 180 is also called data programming. Data programming is done in units of pages. One page can write (store) a page of data. Erasing is done in units of blocks. The size of a page is, for example, 16KB. A page can be divided into 4 sectors, and the size of a sector is, for example, 4KB.
[0058] In one embodiment, in order to improve the performance of the data storage device 140, the memory controller 160 virtualizes multiple blocks into a super block, and virtualizes multiple pages in different blocks of a super block into a super page (SP), and uses the super page SP as the unit of data programming, so that one super page SP can write (store) a super page data SPD. For example, if the flash memory 180 adopts a 1-way 4-channel architecture, such as Figure 2 The structure of the flash memory 180 is i=0 and j=3, then a super page SP includes 4 pages, and a super page SP can store 4 page data. If the flash memory 180 adopts a 4-way 2-channel structure, for example Figure 2The structure of the flash memory 180 is i=3 and j=1, then a super page SP includes 8 pages. At this time, a super page SP can store 8 page data, and so on. For the sake of convenience, the structure of the flash memory 180 in the following is taken as an example of 4 channels and 4 channels, that is, in Figure 2 The structure of the flash memory 180 is i=3 and j=3, but the present invention is not limited thereto.
[0059] In one embodiment, the host 120 commands the data storage device 140 to read or write data (user data) of 512B or 4KB in size, and uses a logical address as an index of the data. The logical address may be, for example, a logical block address (LBA), a global host page (GHP), a host block, a host page, etc. When the data storage device 140 is operating, the memory controller 160 preferably manages the data from the host 120 in a segment size (4KB), and creates / updates a logical to physical address mapping table (L2P table), which indicates mapping information from a logical address to a physical space, in response to a command from the host 120.
[0060] If the capacity of the DRAM 190 is limited, or the data storage device 140 is not configured with the DRAM 190 and uses the host memory buffer, the entire L2P table cannot be loaded into the DRAM 190 or the host memory buffer (HMB). In this case, the memory controller 160 only loads a portion of the L2P table into the DRAM 190 or the host memory buffer.
[0061] Figure 4 Schematic diagram of an L2P table and a group mapping table according to an embodiment of the present invention. In one embodiment, the L2P table 400 can be equally divided into a plurality of group mapping tables 401, for example, 1024 group mapping tables 401. The size of the group mapping table 401 is, for example, 4K bytes. Assuming that the size of each entry in the group mapping table 401 is 4 bytes, the group mapping table 401 can record 1024 mapping information. In order to facilitate the management of the group, the size of a group mapping table is preferably equal to or less than the page size or the segment size, which is consistent with the unit of data management.
[0062] The memory controller 160 may, for example, store a portion of the group mapping table 401 in the logical-to-physical address mapping table 400 in the first predetermined space 420 in the dynamic random access memory 190. For example, 16 group mapping tables 401 may be stored in the first predetermined space 420. Figure 4 shown.
[0063] The memory controller 160 receives one or more access instructions from the host 120 to access data stored in the flash memory 180. The access instructions may be, for example, a write instruction, a read instruction, a trim instruction, etc. For example, if the write instruction carries 64 logical addresses (which may be represented by a logical start address plus 63 logical address quantities) and 64 data, the memory controller 160 may write the 64 data into a super page and update the contents of the 64 logical addresses in the L2P table.
[0064] In one embodiment, assuming that the access instruction received by the memory controller 160 from the host 120 is a write instruction, the memory controller 160 first determines whether the group mapping table 401 corresponding to each logical address of the access instruction has been stored in the dynamic random access memory 190. If each group mapping table 401 corresponding to each logical address of the access instruction has been stored in the dynamic random access memory 190, the memory controller 160 directly accesses or updates the group mapping table 401 in the dynamic random access memory 190; if the corresponding group mapping table 401 has not been stored in the dynamic random access memory 190, the controller 160 reads the corresponding group mapping table 401 from the flash memory 180 to the dynamic random access memory 190, for example, using a predetermined swap mechanism to replace the read group mapping table 401 with the group mapping table 401 originally stored in the dynamic random access memory 190. The predetermined replacement mechanism may be, for example, a least recently used (LRU) algorithm, a least frequently used (LFU) algorithm, a first-in-first-out (FIFO) algorithm, a second chance algorithm, etc., but the present invention is not limited thereto.
[0065] Figure 5AThe figure is a schematic diagram of the interleaving programming mechanism of the flash memory according to one embodiment of the present invention. Data programming includes a setup phase and a programming phase, and the interleaving programming mechanism is a method of accelerating data programming, so that different blocks on the same channel are placed in the setup phase and the programming phase in turn, so as to save the time required for the setup phase or the programming phase. Taking the chip enable signal CE0 as an example, in the setup phase, the memory controller 160 sets the chip enable signal CE0 to a low logic state, and outputs operation instructions such as ALE, CLE, WE to select the four blocks of LUN in channels CH0~CH3. Then, the memory controller 160 transmits the four page data of the super page data SP1 to the four blocks of LUN in channels CH0~CH3 respectively, wherein the time spent in the setup phase is, for example, referred to as the setup time T s In the setting phase, the memory controller 160 commands the above four blocks to write the received page data to the designated page (physical address), wherein the time spent in the programming phase is, for example, referred to as programming time T prog When the above blocks are placed in the programming stage, the memory controller 160 sets the chip enable signal CE0 to a high logic state and sets the chip enable signal CE1 to a low logic state, so that the other 4 blocks in channels CH0 to CH3 enter the setting stage. Among them, these 4 blocks and the first 4 blocks are preferably placed in different LUNs. In this way, different blocks on the same channel can be placed in the setting stage and the programming stage in turn.
[0066] In one embodiment, the memory controller 160 controls the LUNs in the same channel CH using only a single chip enable signal, but uses the physical address as the basis for selecting the block of the LUN.
[0067] When the memory controller 160 receives an access instruction (e.g., a write instruction) from the host 120, the memory controller 160 preferably uses a super page SP as a unit of data management. Because the architecture of the flash memory 180 is 4-way 4-channel, one super page data SPD includes 16 pages of data (64 segments of data), and the memory controller 160 writes the 16 pages of data into 16 physical pages of the flash memory 180 in batches or sequentially. For example, to write the super page data SPD1 into the flash memory 180, the memory controller 160 first enables the chip enable signal CE0, and writes the 4 pages of the super page data SPD1 into the 4 physical pages of different channels respectively, and then enables the chip enable signals CE1-CE3 sequentially according to the above method, and writes the remaining 12 pages of data into the other 12 physical pages respectively.
[0068] It should be noted that once the four LUNs controlled by the same chip enable control signal CE enter the programming phase, these LUNs will be in a busy state, and will not leave the busy state and enter the ready state until the programming phase of these LUNs is completed. At this time, the memory controller 160 can perform other operations on these LUNs, such as read or write operations.
[0069] For example, when the memory controller 160 executes the first write command, the chip enable signals CE0, CE1, CE2, and CE3 may be set to a low logic state at time t1, t2, t3, and t4 to enter the setting phase, and the page data may be transmitted to the blocks of each chip channel CH0 to CH3, for example, the page data SPD1_0 to 3 of the super page data SPD1 may be transmitted to the four blocks of channels CH0 to CH3 at time t1, and the page data SPD1_0 to 3 of the super page data SPD1 may be transmitted to the four blocks of channels CH0 to CH3 at time t2. The page data SPD1_4-7 of the super page data SPD1 is transmitted to the 4 blocks of the channels CH0-CH3, and the page data SPD1_8-11 of the super page data SPD1 is transmitted to the 4 blocks of the channels CH0-CH3 at time t3, and the page data SPD1_12-15 of the super page data SPD1 is transmitted to the 4 blocks of the channels CH0-CH3 at time t4, wherein the intervals between the two adjacent intervals at time t1, t2, t3, and t4 are the setting time T s .
[0070] At time t5, after the setting phase of the four blocks of channels CH0-CH3 controlled by the chip enable signal CE3 ends, the memory controller 160 causes the four blocks to enter the programming phase. When the four blocks complete the programming phase (enter the ready state from the busy state), the programming of the super page data SPD1 ends (completes).
[0071] At time t6, the four blocks of channels CH0-CH3 controlled by the chip enable signal CE0 have completed the programming phase (the programming time T from time t2 to time t6). prog ), the memory controller 160 can start programming the super page data SPD2. For example, at time t6, the memory controller 160 sets the chip enable signal CE0 to a low logic state, and outputs operation instructions such as ALE, CLE, and WE to select four blocks located in channels CH0 to CH3, and transmits four pages of data SPD2_0 to SPD2_3 of the super page data SPD2 to these four blocks respectively, and repeats the above steps to complete the programming of the super page data SPD2.
[0072] However, since the space of the dynamic random access memory 190 in the data storage device 140 can only store 16 group mapping tables 401, in order to ensure the correctness of the content of the group mapping table 401, the memory controller 160 will immediately update the content of the group mapping table 401 after writing the page data. However, this will cause conflicts in data writing and reading. For example, the memory controller 160 receives a write instruction from the host 120, such as writing a 64-piece segment data. When executing this write instruction, the memory controller 160 uses the 64 pieces of segment data as super page data SPD1, and then writes the 16 pieces of page data of the super page data SPD1 into the flash memory 180 in sequence. In the process of writing the super page data SPD1, the mapping relationship between the logical address and the physical address of the super page data SPD1 will also change in sequence. Therefore, the memory controller 160 needs to update the content of one or more group mapping tables 401, and then write the updated group mapping table 401 into the flash memory 180. If the group mapping table 401 to be updated is not in the dynamic random access memory 190, the memory controller 160 needs to first read the group mapping table 401 to be updated from the flash memory 180. The more group mapping tables 401 to be updated are not in the dynamic random access memory 190, the more time the memory controller 160 needs to consume to read the group mapping table 401 from the flash memory 180, and similarly, the more time it needs to consume to write the updated group mapping table 401 into the flash memory 180.
[0073] As described above, the update of the group mapping table 401 conflicts with the writing of the super page data SPD. In addition, generally speaking, the memory controller 160 will execute the read instruction with a higher priority or by using an interrupt signal, including the read instruction from the host 120 or the memory controller 160. Of course, the memory controller 160 can also execute the instructions in the instruction queue in sequence, and the instruction queue can be stored in a instruction buffer (not shown), for example. Figure 5B As shown, at time t2, the memory controller 160 reads a group mapping table 401 from the LUN corresponding to the channel CH0. The read instruction includes: an instruction loading stage (loading time T CMD ) and data transmission phase (transmission time T DMA). It should be noted that in order to execute the read instruction, the interleaved write operation of the super page data SPD1 is forced to be interrupted, and it is necessary to wait until time t8 before the memory controller 160 can continue to enable the chip enable signal CE1, CE2, or CE3 to write the remaining page data SPD1_4 to SPD1_15. This will cause the programming phase of the LUN of the channels CH0 to CH3 of the chip enable signal CE1, CE2, or CE3 to be unable to fully overlap with the programming phase of the LUN of the channels CH0 to CH3 of the chip enable signal CE0, increasing the time for the super page data SP1 to be completely written into the flash memory 180, resulting in a decrease in write performance (the amount of data written to the data storage device 140 per unit time decreases), and also increases the complexity of data management and instruction execution.
[0074] In addition, in the worst case, the group mapping table 401 to be read by the memory controller 160 happens to be located in the LUN corresponding to the current chip enable signal CE. Figure 5C As shown, the memory controller 160 does not complete the operation of the channels CH0-CH3 of the chip enable signal CE0 until time t11, and can continue the operation of the LUN corresponding to the channels CH0-CH3 of the chip enable signals CE1-CE3. As can be seen from the figure, from time t1 to t11, the memory controller 160 cannot perform any operation on the channels CH0-CH3 of the chip enable signals CE1-CE3, and the time for the super page data SPD1 to be completely written to the flash memory 180 is greatly extended, thereby causing the write performance of the data storage device 140 to be seriously reduced. This situation is easy to occur in an environment where random data is written, which causes the write performance of the data storage device 140 to be seriously reduced in an environment where random data is written.
[0075] Figure 5D and 5E A schematic diagram of adding a read operation to the interleaving mechanism of a write operation of a flash memory according to an embodiment of the present invention.
[0076] In the present invention, the memory controller 160 first completes the write instruction being executed (for example, the current write instruction). After the current write instruction is executed, it is determined whether there is a read instruction in the instruction queue. If so, the read instruction is executed. For example, the memory controller 160 receives two access instructions from the host 120, for example, two write instructions for writing 64 segment data respectively; then, it receives the first read instruction for reading the data of LBA#1000. Assuming that the memory controller 160 has started to execute the first write instruction, the memory controller 160 continues to execute the first write instruction. After completing the execution of the first write instruction, the memory controller 160 determines whether to execute the read instruction in the instruction queue. Since there is the first read instruction in the instruction queue, the memory controller 160 then executes the first read instruction for reading the data of LBA#1000. In addition, due to the execution of the first write instruction, the memory controller 160 determines whether the (one or more) group mapping tables 401 corresponding to the first write instruction have all been temporarily stored in the dynamic random access memory 190. For the group mapping tables 401 that have not been temporarily stored in the dynamic random access memory 190, the memory controller 160 generates a second read instruction to read the group mapping table 401. When executing the first read instruction, the memory controller 160 can simultaneously, subsequently or later execute the second read instruction to read the group mapping table 401 corresponding to the first write instruction. After obtaining the group mapping table 401, the memory controller 160 updates the content of the group mapping table 401 according to the physical address of the segment data of the first write instruction.
[0077] Afterwards, the memory controller 160 executes a second write instruction to write 64 segment data. Afterwards, the memory controller 160 generates a third read instruction to read one or more group mapping tables 401 corresponding to the second write instruction. If the second read instruction is still in the instruction queue, the memory controller 160 executes the second read instruction. The memory controller 160 then executes the third read instruction to obtain one or more group mapping tables 401 corresponding to the second write instruction, and updates the content of the group mapping table 401 according to the physical address of the segment data of the second write instruction. Afterwards, the memory controller 160 generates and executes a third write instruction to write the updated group mapping table 401 to the flash memory 180. If there are still updated group mapping tables 401 that have not been written to the flash memory 180, the memory controller 160 generates and executes a fourth write instruction to write the remaining updated group mapping tables 401 to the flash memory 180.
[0078] In addition, the memory controller 160 preferably records the update status of the group mapping table 401 temporarily stored in the DRAM 190. For example, when the number of the group mapping table 401 updated by the DRAM 190 is greater than or equal to a preset value, such as 16, a third write instruction is generated and executed.
[0079] For example, if Figure 5D As shown, at time t13, after the memory controller 160 completes the execution of the first write instruction, that is, after the programming phase of the LUNs of the chip enable signals CE0 to CE3 is completed, assuming that the group mapping table 401 recording LBA#1000 is already in the dynamic random access memory 190, the memory controller 160 queries the group mapping table 401 and learns that the data of LBA#1000 is stored in the LUN of the channel CH0 located at the chip enable signal CE3, then the memory controller 160 enables the chip enable signal CE3 and reads the data of LBA#1000 from the LUN of the channel CH0. In addition, the second read instruction is to read a group mapping table 401 located in the LUN of the channel CH1 of the chip enable signal CE0, the memory controller 160 can simultaneously enable the chip enable signal CE0 and read the group mapping table 401 from the LUN of the channel CH1, and upload the group mapping table 401 to the second predetermined space 430 of the dynamic random access memory 190. After obtaining the group mapping table 401, the memory controller 160 can update the content of the group mapping table 401. At time t14, the two read instructions have been executed. Assuming that there is no read instruction in the instruction queue, the memory controller 160 starts to execute the second write instruction, for example, using the same interleaving mechanism to write 64 segment data into the LUNs corresponding to the channels CH0-CH3 of the chip enable signals CE0-CE3, and the details can refer to the above embodiment.
[0080] It should be noted that the first predetermined space 420 of the dynamic random access memory 190 is preferably used to store the group mapping table 401 required for executing a read instruction, and the second predetermined space 430 of the dynamic random access memory 190 is preferably used to store the group mapping table 401 required for executing a write instruction. The memory controller 160 preferably counts the number of group mapping tables 401 in the first predetermined space 420 and the second predetermined space 430, respectively, and dynamically adjusts the size of the first predetermined space 420 or the second predetermined space 430.
[0081] Next, at time t15, after the writing operation of the super page data SPD2 is completed, the memory controller 160 has also completed the update of the group mapping table 401. At this time, the memory controller 160 can write the updated group mapping table 401 to the flash memory 180, or, when a predetermined condition is met, the memory controller 160 will write the updated group mapping table 401 in the first predetermined space 420 back to the flash memory 180. For example, the number of updated group mapping tables 401 is greater than or equal to 64, so that the memory controller 160 can form 64 updated group mapping tables 401 into a super page data SPD, and then write the super page data SPD into the flash memory 180.
[0082] In addition, the memory controller 160 does not need to wait for the super page data SPD1 to be written before executing other read instructions. As long as the LUN has entered the ready state from the busy state, the memory controller 160 can operate the LUN. For example, when the LUN corresponding to the channels CH0-CH3 of the last chip enable signal (e.g., CE3) has entered the programming phase, and after the programming phase of the LUN corresponding to the channels CH0-CH3 of the chip enable signal CE0 has ended (time t6), the memory controller 160 can read the group mapping table 401 in the channels CH0-CH3 of the chip enable signal CE0, such as Figure 5E Alternatively, if there is no read instruction in the instruction queue, the writing of the super page data SPD2 is started.
[0083] Compared to Figure 5B and 5C ,exist Figure 5D and 5E In the embodiment, the execution of the read instruction will not affect the writing of the super page data SPD, so that the data storage device 140 can write more data to the flash memory 180 per unit time, thereby achieving better writing performance.
[0084] Figure 6 is a flow chart showing a method for updating a logical-to-physical address mapping table according to an embodiment of the present invention.
[0085] Please also refer to Figure 1 and Figure 6 In one embodiment, in step S610, the memory controller 160 divides the flash memory 180 into a first LUN and a second LUN, wherein the first LUN and the second LUN are controlled by a first chip enable signal and a second chip enable signal, respectively.
[0086] In step S620 , the memory controller 160 combines the plurality of page data into super page data SPD. For example, the memory controller 160 may receive a write command from the host 120 , and combine the plurality of page data in the write command into super page data.
[0087] In step S630, the memory controller 160 sequentially enables the first chip enable signal and the second chip enable signal to write the super page data SPD segments to the first LUN and the second LUN. For example, the memory controller 160 may use an interleaving mechanism to write the first part and the second part of the super page data to the first LUN and the second LUN, respectively. The timing diagram of the interleaving mechanism can be referred to Figures 5D to 5E .
[0088] In step S640, the memory controller 160 reads at least one group mapping table from the first LUN or the second LUN. For example, the at least one group mapping table read by the memory controller 160 may be a group mapping table corresponding to a logical address in a read instruction from the host 120r, or may be a group mapping table corresponding to a logical address in a write instruction, but has not yet been stored in the dynamic random access memory 190. In one embodiment, if the group mapping table to be used by the memory controller 160 has not yet been stored in the dynamic random access memory 190, the memory controller 160 will add the read instruction of the group mapping table to be used to the instruction queue. In addition, the memory controller 160 will give priority to completing the executing write instruction (for example, the current write instruction), and after the current write instruction is executed, it will determine whether there is a read instruction in the instruction queue, and if so, execute the read instruction.
[0089] In step S650, the memory controller 160 updates at least one group mapping table according to the multiple logical addresses of the page data and the physical addresses written to the first LUN and the second LUN. Because after writing the super page data to the first LUN and the second LUN, the logical to physical address mapping relationship of each page data in the super page data will also change. Therefore, the memory controller 160 can update the read at least one group mapping table according to the multiple logical addresses corresponding to the page data in the write command and the physical addresses written to the first LUN and the second LUN.
[0090] In step S660, the memory controller 160 writes the updated at least one group mapping table to one of the first LUN and the second LUN. Because the at least one group mapping table updated by the memory controller 160 is also part of the logical to physical address mapping table (L2P table) in the flash translation layer 181, the memory controller 160 writes the updated at least one group mapping table to one of the first LUN and the second LUN at an appropriate time (for example, when a predetermined condition is satisfied). The predetermined condition is, for example, that the number of updated group mapping tables in the dynamic random access memory 190 reaches a predetermined number, such as the number of pages of a super page, but the present invention is not limited thereto.
[0091] In summary, the present invention provides a data storage device and an update method for updating a logical-to-physical address mapping table, which can provide an update mechanism for a group mapping table when executing a write instruction when the space of a dynamic random access memory of a controller of the data storage device is insufficient to store the entire logical-to-physical address mapping table, so that when the memory controller executes a write instruction of a super page, it is not necessary to interrupt the interleaving mechanism of the write operation of the LUN of different chip enable signals, and the group mapping table required for the write instruction can be read from the flash memory to the dynamic random access memory at a predetermined time, and the group mapping table can be updated at an appropriate time and the updated group mapping table can be written back to the flash memory, thereby improving the write performance of the data storage device.
[0092] Although the present invention is disclosed as above with preferred embodiments, it is not intended to limit the scope of the present invention. Any person with ordinary knowledge in the technical field may make some changes and modifications without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be defined by the claims.
Claims
1. A data storage device, comprising: A flash memory for storing a logical-to-physical address mapping table, wherein the logical-to-physical address mapping table is divided into a plurality of group mapping tables, wherein the flash memory includes a first logic unit number and a second logic unit number respectively controlled by a first chip enable signal and a second chip enable signal; a dynamic random access memory for storing a portion of the group mapping tables; as well as A memory controller is used to receive a write command from a host and form a super page data with multiple page data of the write command; The memory controller sequentially enables the first chip enable signal and the second chip enable signal to write the super page data segment into the first logic unit number and the second logic unit number. In response to the super page data being written into the first logical unit number and the second logical unit number, the memory controller reads at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory.
2. The data storage device according to claim 1, wherein: When the first chip enable signal is enabled to write a first section of the super page data to the first logical unit number and a first read instruction corresponding to the at least one group mapping table has been stored in a command queue, the memory controller waits for the first logical unit number to enter a programming phase, and then enables the second chip enable signal to write a second section of the super page data to the second logical unit number; and In response to the super page data being written into the first logical unit number and the second logical unit number, the memory controller executes the first read instruction to read the at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory.
3. The data storage device according to claim 1, wherein: When the first chip enable signal is enabled to write a first segment of the super page data into the first logical unit number and a first read instruction corresponding to the at least one group mapping table has been stored in a command queue: In response to the at least one group mapping table being located at the first logical unit number, after the programming phase of the first logical unit number is completed, the memory controller executes the first read instruction to read the at least one group mapping table from the first logical unit number to the dynamic random access memory; as well as In response to the at least one group mapping table being located at the second logical unit number, after the programming phase of the first logical unit number and the second logical unit number is completed, the memory controller executes the first read instruction to read the at least one group mapping table from the second logical unit number to the dynamic random access memory.
4. The data storage device according to claim 3, wherein: After executing the first read instruction to read the at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory, the memory controller further updates the at least one group mapping table based on multiple logical addresses of the page data of the write instruction and multiple physical addresses written to the first logical unit number and the second logical unit number.
5. The data storage device according to claim 4, wherein: After updating the at least one group mapping table, in response to a predetermined condition being satisfied, the memory controller writes the updated group mapping table stored in the dynamic random access memory into the flash memory.
6. The data storage device according to claim 5, wherein: The predetermined condition is that the number of the updated group mapping tables in the dynamic random access memory reaches a predetermined number.
7. A method for updating a logical-to-physical address mapping table, for a data storage device, wherein the data storage device comprises a flash memory and a dynamic random access memory, the flash memory is used to store a logical-to-physical address mapping table, wherein the logical-to-physical address mapping table is divided into a plurality of group mapping tables, wherein the flash memory comprises a first logical unit number and a second logical unit number respectively controlled by a first chip enable signal and a second chip enable signal, the method comprising: Combining multiple page data of a write command from a host into a super page data; Sequentially enabling the first chip enable signal and the second chip enable signal to write the super page data segment into the first logic unit number and the second logic unit number; and In response to the super page data being written into the first logical unit number and the second logical unit number, at least one group mapping table is read from the first logical unit number or the second logical unit number to the dynamic random access memory.
8. The method for updating the logical-to-physical address mapping table according to claim 7, wherein: The step of reading at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory includes: When the first chip enable signal is enabled to write a first section of the super page data into the first logical unit number and a first read instruction corresponding to the at least one group mapping table has been stored in a command queue, after waiting for the first logical unit number to enter a programming phase, the second chip enable signal is enabled to write a second section of the super page data into the second logical unit number; and In response to the super page data being written into the first logical unit number and the second logical unit number, the first read instruction is executed to read the at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory.
9. The method for updating the logical-to-physical address mapping table according to claim 7, wherein: The step of reading at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory includes: When the first chip enable signal is enabled to write a first segment of the super page data into the first logical unit number and a first read instruction corresponding to the at least one group mapping table has been stored in a command queue: In response to the at least one group mapping table being located at the first logical unit number, after the programming phase of the first logical unit number is completed, executing the first read instruction to read the at least one group mapping table from the first logical unit number to the dynamic random access memory; and In response to the at least one group mapping table being located at the second logical unit number, after the programming phase of the first logical unit number and the second logical unit number is completed, the first read instruction is executed to read the at least one group mapping table from the second logical unit number to the dynamic random access memory.
10. The method for updating the logical to physical address mapping table according to claim 9, characterized in that: After executing the first read instruction to read the at least one group mapping table from the first logical unit number or the second logical unit number to the dynamic random access memory, the method further includes: The at least one group mapping table is updated according to a plurality of logical addresses of the page data of the write command and a plurality of physical addresses written to the first logical unit number and the second logical unit number.
11. The method for updating the logical to physical address mapping table according to claim 10, characterized in that: After updating the at least one group mapping table, the method further includes: In response to a predetermined condition being satisfied, the updated group mapping table stored in the dynamic random access memory is written into the flash memory.
12. The method for updating the logical to physical address mapping table according to claim 11, characterized in that: The predetermined condition is that the number of the updated group mapping tables in the dynamic random access memory reaches a predetermined number.
Citation Information
Patent Citations
Methods, data storage devices and systems for fragmented firmware table rebuild in a solid state drive
CN104969196A
Methods, devices and systems for physical-to-logical mapping in solid state drives
CN105027090A
Data storage device and flash memory control method
CN108280032A
Data Storage Device and Method for Rebuilding Mapping Table
CN108733510A
Storage devices including logical to physical address mapping and methods of operating same
CN109032968A
