Method and device for improving IO command processing parallelism
By optimizing the processing method of IO requests in solid-state storage devices, the problem of reduced parallelism caused by the FTL table lock mechanism is solved, the processing efficiency of IO commands is improved, and the delay is reduced.
Patent Information
- Application Number
- CN202010887341.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2016-07-01
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2036-07-01
AI Technical Summary
The processing of IO requests in solid-state storage devices reduces parallelism due to the locking mechanism of the FTL table, which increases the processing delay of IO requests.
By optimizing the processing of IO requests in solid-state storage devices, including pausing processing when the write position lags behind the physical address during a read request, until the write position advances, or when the physical block or large block is in the written or The data is read directly during the erase state, and the physical address is allocated after acquiring the lock during the write request and the FTL table entry is updated to avoid lock waiting.
It improves the IO command processing capabilities of solid-state storage devices, reduces the processing delay of IO commands, and improves parallel processing capabilities.
Smart Images

Figure CN111831589B
Abstract
Description
Technical Field
[0001] The present invention relates to a solid-state storage device, and more specifically, to a method, a device and a device for improving the parallelism of IO command processing when the solid-state storage device processes IO requests. Background Art
[0002] See also Figure 1 , showing a block diagram of a storage device. The storage device 102 is coupled to the host to provide storage capabilities for the host. The host and the storage device 102 can be coupled in a variety of ways, including but not limited to connecting the host and the storage device 102 through, for example, SATA, IDE, USB, PCIE, NVMe (NVM Express), SAS, Ethernet, Fiber Channel, wireless communication network, etc. The host can be an information processing device that can communicate with the storage device in the above manner, such as a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 102 includes an interface 103, a control component 104, one or more NVM (non-volatile memory) chips 105, and optionally a firmware memory 110. The interface 103 can be adapted to exchange data with the host through, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fiber Channel, etc. The control component 104 is used to control data transmission between the interface 103, the NVM chip 105 and the firmware memory 110, and is also used for storage management, host logical address to flash physical address mapping, erase leveling, bad block management, etc. The control component 104 can be implemented in a variety of ways such as software, hardware, firmware or a combination thereof. The control component 104 can be in the form of an FPGA (Field-programmable gate array), an ASIC (Application Specific Integrated Circuit) or a combination thereof. The control component 104 can also include a processor or a controller. The control component 104 loads firmware from the firmware memory 110 at runtime. The firmware memory 110 can be a NOR flash memory, a ROM, an EEPROM, or a part of the NVM chip 105.
[0003] In a solid-state storage device, a Flash Translation Layer (FTL) is used to maintain mapping information from logical addresses to physical addresses. The logical address constitutes the storage space of the solid-state storage device perceived by upper-layer software such as the operating system. The physical address is the address used to access the physical storage unit of the solid-state storage device. In the prior art, address mapping can also be implemented using an intermediate address form. For example, the logical address is mapped to an intermediate address, and the intermediate address is further mapped to a physical address.
[0004] The table structure that stores the mapping information from logical addresses to physical addresses is called an FTL table. The FTL table is an important metadata in a solid-state storage device. Usually, the data items of the FTL table record the address mapping relationship in units of data pages in the solid-state storage device.
[0005] The FTL table includes multiple FTL table entries (or table items). In one embodiment, each FTL table entry records the correspondence between a logical page address and a physical page. In another example, each FTL table entry records the correspondence between multiple consecutive logical page addresses and multiple consecutive physical pages. In yet another embodiment, each FTL table entry records the correspondence between a logical block address and a physical block address. In still yet another embodiment, the FTL table records the mapping relationship between the logical block address and the physical block address, and / or the mapping relationship between the logical page address and the physical page address.
[0006] Figure 2 Schematic diagram of the control component accessing the FTL table in the prior art. The control component 204 includes multiple CPUs (CPU 210, CPU 212 and CPU 214) and a flash memory interface. The CPU of the control component accesses the NVM chip in the solid-state storage device through the flash memory interface. The FTL table is stored in a memory outside the control component 204. The FTL table includes multiple entries (entry 220, entry 222 and entry 224). Each of the multiple CPUs can independently access the FTL table. Since the FTL table entry may be accessed by multiple CPUs at the same time, a lock is provided for each FTL table entry to achieve data consistency. See Figure 2To update the FTL table entry 224, the CPU 210 checks the lock 234 of the FTL table entry 224. When the lock 234 indicates that the FTL table entry 224 is not locked, the CPU 210 obtains the lock 234 (for example, sets the lock 234 to a locked state) and obtains the FTL table entry 224 (at time t1). Next, the CPU 210 operates on the obtained FTL table entry 224, updates the FTL table entry 224 at time t4, and releases the lock 234 (for example, sets the lock 234 to an unlocked state). During the time period t1-t4, the other CPUs (CPU 212 and CPU 214) retrieve the existence of the lock 234 and temporarily give up access to the FTL table entry 224. Figure 2 In the example, at time t2, CPU 212 tries to access FTL entry 224, but finds that it cannot obtain lock 234, so it gives up accessing FTL entry 224. Similarly, CPU 214 also gives up accessing FTL entry 224 at time t3 because it cannot obtain lock 234. After time t4, CPU 210 releases lock 234, and the CPU 212 and CPU 214 that grabs lock 234 will access FTL entry 234. In another example, during the time period t1-t4, a task of CPU 210 obtains lock 234, while another task in CPU 210 temporarily gives up accessing FTL entry 224 because it does not obtain lock 234.
[0007] The locks of the FTL table entries may be stored in the same location of the corresponding FTL table entries, or the locks of multiple FTL table entries may be centrally stored in another storage space. Summary of the invention
[0008] In a solid-state storage device, multiple IO requests are processed simultaneously, and almost every IO request needs to access the FTL table. The lock mechanism serializes the access to the FTL table entries, which reduces the parallel processing capability of the solid-state storage and increases the processing delay of the IO request.
[0009] In the present invention, a first method for processing IO requests according to the first aspect of the present invention is provided, comprising: in response to receiving a first read request, accessing a first FTL table entry corresponding to the first read request, and obtaining a first physical address recorded in the first FTL table entry; if the current write position lags behind the first physical address, suspending processing of the first read request until the current write position is ahead of the first physical address.
[0010] According to the first method for processing IO requests according to the first aspect of the present invention, a second method for processing IO requests according to the first aspect of the present invention is provided, further comprising: reading data from a first physical address in response to the first read request.
[0011] According to the third method for processing IO requests of the first aspect of the present invention, the method includes: in response to receiving a first read request, accessing a first FTL table entry corresponding to the first read request, and obtaining a first physical address recorded in the first FTL table entry; if the physical block or large block containing the first physical address is in a written state, and if the current write position is ahead of the first physical address, reading data from the first physical address to respond to the first read request.
[0012] According to the third method for processing IO requests according to the first aspect of the present invention, a fourth method for processing IO requests according to the first aspect of the present invention is provided, further comprising: if the physical block or large block containing the first physical address is in an erased state, replaying the first read request.
[0013] According to the third or fourth method for processing IO requests according to the first aspect of the present invention, a fifth method for processing IO requests according to the first aspect of the present invention is provided, which also includes: if the current write position lags behind the first physical address, suspending the processing of the first read request until the current write position is ahead of the first physical address.
[0014] According to the fourth method for processing IO requests according to the first aspect of the present invention, a sixth method for processing IO requests according to the first aspect of the present invention is provided, wherein replaying the first read request includes: accessing the first FTL table entry corresponding to the first read request, obtaining the second physical address recorded in the first FTL table entry; if the physical block or large block containing the second physical address is in a written state, and if the current write position is ahead of the second physical address, reading data from the second physical address to respond to the first read request.
[0015] According to one of the third to sixth methods of processing IO requests according to the first aspect of the present invention, a seventh method of processing IO requests according to the first aspect of the present invention is provided, wherein the current write position is the current write position of a physical block or a large block containing a first physical address.
[0016] According to the second aspect of the present invention, the first method for processing IO requests includes: in response to receiving a first read request, accessing a first FTL table entry corresponding to the first read request, and obtaining a first physical address recorded in the first FTL table entry; reading data from the first physical address; if the result of reading the data from the first physical address indicates that the physical page where the first physical address is located is in an erased state, if the current write position lags behind the first physical address, suspending the processing of the first read request until the current write position is ahead of the first physical address.
[0017] According to the first method for processing IO requests according to the second aspect of the present invention, a second method for processing IO requests according to the second aspect of the present invention is provided, which also includes: after the current write position is ahead of the first physical address, reading data from the first physical address to respond to the first read request.
[0018] According to the third method for processing IO requests of the second aspect of the present invention, the method includes: in response to receiving a first read request, accessing a first FTL table entry corresponding to the first read request, and obtaining a first physical address recorded in the first FTL table entry; reading data from the first physical address; if the result of reading the data from the first physical address indicates that the physical page where the first physical address is located is in an erased state, and the physical block or large block containing the first physical address is in a written state, if the current write position lags behind the first physical address, suspending the processing of the first read request until the current write position is ahead of the first physical address.
[0019] According to the third method for processing IO requests according to the second aspect of the present invention, a fourth method for processing IO requests according to the second aspect of the present invention is provided, which also includes: after the current write position is ahead of the first physical address, reading data from the first physical address to respond to the first read request.
[0020] According to the third method for processing IO requests according to the second aspect of the present invention, there is provided a fifth method for processing IO requests according to the second aspect of the present invention, further comprising: if the result of reading data from the first physical address indicates that the physical page where the first physical address is located is in an erased state, and the physical block or large block containing the first physical address is in an erased state, the first FTL table entry corresponding to the first read request obtains the second physical address recorded in the first FTL table entry; and reads data from the second physical address.
[0021] According to the fifth method for processing IO requests according to the second aspect of the present invention, a sixth method for processing IO requests according to the second aspect of the present invention is provided, which also includes: after obtaining the second physical address recorded in the first FTL table entry, if the current write position lags behind the second physical address, suspending the processing of the first read request until the current write position is ahead of the second physical address.
[0022] According to the sixth method for processing IO requests according to the second aspect of the present invention, a seventh method for processing IO requests according to the second aspect of the present invention is provided, further comprising: after the current write position is ahead of the second physical address, reading data from the second physical address in response to the first read request.
[0023] According to the third aspect of the present invention, a first method for processing IO requests includes: in response to receiving a write request, accessing a first FTL table entry corresponding to the write request, and if the first FTL table entry is not locked, locking the first FTL table entry; allocating a first physical address to the write request, updating the first FTL table entry with the first physical address, unlocking the first FTL table entry, writing data to the first physical address, and updating the current write position; in response to receiving a read request, accessing the first FTL table entry corresponding to the read request, and obtaining the first physical address recorded in the first FTL table entry; if the current write position lags behind the first physical address, suspending processing of the first read request until the current write position is ahead of the first physical address.
[0024] According to the first method for processing IO requests according to the third aspect of the present invention, a second method for processing IO requests according to the third aspect of the present invention is provided, which also includes: in response to receiving a second write request, if the first FTL table entry is locked, terminating the processing of the second write request until the lock of the first FTL table entry is released.
[0025] According to the second method for processing IO requests according to the third aspect of the present invention, a third method for processing IO requests according to the third aspect of the present invention is provided, further comprising: after the lock of the first FTL table entry is released, acquiring the first FTL table entry and locking the first FTL table entry.
[0026] According to the first to third methods for processing IO requests according to the third aspect of the present invention, a fourth method for processing IO requests according to the third aspect of the present invention is provided, which also includes: in response to receiving a read request, accessing a first FTL table entry corresponding to the read request, and obtaining a first physical address recorded in the first FTL table entry; if the physical block containing the first physical address is in an erased state, replaying the read request.
[0027] According to the first to fourth methods for processing IO requests according to the third aspect of the present invention, a fifth method for processing IO requests according to the third aspect of the present invention is provided, which also includes: after the current write position is ahead of the first physical address, reading data from the first physical address to respond to the read request.
[0028] According to one of the first to fifth methods of processing IO requests according to the third aspect of the present invention, a sixth method of processing IO requests according to the third aspect of the present invention is provided, wherein assigning a first physical address to the write request includes taking a current write position as the first physical address and incrementing the current write position.
[0029] According to the fourth aspect of the present invention, the first device for processing IO requests includes: an FTL table entry access module, which is used to access the first FTL table entry corresponding to the first read request in response to receiving the first read request, and obtain the first physical address recorded in the first FTL table entry; a current write position processing module, which is used to suspend the processing of the first read request if the current write position lags behind the first physical address until the current write position is ahead of the first physical address.
[0030] According to the second device for processing IO requests in the fourth aspect of the present invention, it includes: an FTL table entry access module, which is used to access the first FTL table entry corresponding to the first read request in response to receiving a first read request, and obtain the first physical address recorded in the first FTL table entry; a current write position processing module, which is used to read data from the first physical address to respond to the first read request if the physical block or large block containing the first physical address is in a written state, and if the current write position is ahead of the first physical address.
[0031] According to the first device for processing IO requests in the fifth aspect of the present invention, it includes: an FTL table entry access module, which is used to access the first FTL table entry corresponding to the first read request in response to receiving a first read request, and obtain the first physical address recorded in the first FTL table entry; a current write position processing module, which is used to read data from the first physical address; if the result of reading data from the first physical address indicates that the physical page where the first physical address is located is in an erased state, if the current write position lags behind the first physical address, suspending the processing of the first read request until the current write position is ahead of the first physical address.
[0032] According to the second device for processing IO requests in the fifth aspect of the present invention, the device includes: an FTL table entry access module, which is used to access the first FTL table entry corresponding to the first read request in response to receiving a first read request, and obtain the first physical address recorded in the first FTL table entry; a current write position processing module, which is used to read data from the first physical address; if the result of reading data from the first physical address indicates that the physical page where the first physical address is located is in an erased state, and the physical block or large block containing the first physical address is in a written state, if the current write position lags behind the first physical address, suspending the processing of the first read request until the current write position is ahead of the first physical address.
[0033] According to the sixth aspect of the present invention, the first device for processing IO requests includes: a write request processing module, which is used to access the first FTL table entry corresponding to the write request in response to receiving a write request, and lock the first FTL table entry if the first FTL table entry is not locked; an FTL table entry updating module, which is used to assign a first physical address to the write request, update the first FTL table entry with the first physical address, unlock the first FTL table entry, write data to the first physical address, and update the current write position; a read request processing module, which is used to access the first FTL table entry corresponding to the read request in response to receiving a read request, and obtain the first physical address recorded in the first FTL table entry; a current write position processing module, which is used to suspend the processing of the first read request if the current write position lags behind the first physical address until the current write position is ahead of the first physical address.
[0034] According to a seventh aspect of the present invention, a computer program comprising computer program code is provided. When loaded into a computer system and executed on the computer system, the computer program code enables the computer system to execute the method for processing IO requests provided according to the first to third aspects of the present invention.
[0035] According to an eighth aspect of the present invention, there is provided a program comprising program code, which, when loaded into a storage device and executed on the storage device, causes the storage device to execute the method for processing IO requests provided according to the first to third aspects of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The invention, together with the preferred mode of use and further objects and advantages thereof, will be best understood by reference to the following detailed description of illustrative embodiments when read in conjunction with the accompanying drawings, in which:
[0037] Figure 1 is a block diagram of a storage device of the prior art;
[0038] Figure 2 It is a schematic diagram of a control component of a storage device in the prior art accessing an FTL table;
[0039] Figure 3A is a schematic diagram of a control component of a storage device accessing an FTL table according to an embodiment of the present invention;
[0040] Figure 3B is a schematic diagram of a control component of a storage device accessing an FTL table according to another embodiment of the present invention;
[0041] Figure 3C is a schematic diagram of a control component of a storage device accessing an FTL table according to still another embodiment of the present invention; and
[0042] Figure 4Ais a flow chart of accessing an FTL table for processing a write command according to an embodiment of the present invention;
[0043] Figure 4B is a flow chart of accessing an FTL table for processing a write command according to an embodiment of the present invention;
[0044] Figure 5A is a schematic diagram of a control component of a storage device accessing an FTL table according to another embodiment of the present invention;
[0045] Figure 5B According to the present invention Figure 5A A sequence diagram of processing IO requests in an embodiment;
[0046] Figure 6 is a schematic diagram of organizing physical blocks of NVM into block stripes according to an embodiment of the present invention;
[0047] Figure 7 is a schematic diagram of a control component of a storage device accessing an FTL table according to still another embodiment of the present invention;
[0048] Fig. 8A is a flow chart of accessing an FTL table for processing a write command according to yet another embodiment of the present invention;
[0049] Figure 8B is a flow chart of accessing the FTL table for processing a read command according to yet another embodiment of the present invention;
[0050] Fig. 9A is a flow chart of accessing an FTL table for processing an IO command according to an embodiment of the present invention;
[0051] Fig. 9B is a flow chart of accessing the FTL table for processing an IO command according to yet another embodiment of the present invention;
[0052] Fig. 9C is a flow chart of accessing the FTL table for processing an IO command according to another embodiment of the present invention;
[0053] Fig. 10A is a schematic diagram of a control component of a storage device accessing an FTL table according to another embodiment of the present invention;
[0054] Fig. 10B According to the present invention Fig. 10A A sequence diagram of processing IO requests in an embodiment;
[0055] Fig.11A is a flowchart of processing a write command according to an embodiment of the present invention;
[0056] Fig. 11B is a flowchart of processing a read command according to an embodiment of the present invention;
[0057] Fig. 11C is a flowchart of processing IO commands according to yet another embodiment of the present invention;
[0058] Fig. 12A is a flowchart of processing IO commands according to another embodiment of the present invention; and
[0059] Fig. 12B is a flowchart of processing IO commands according to another embodiment of the present invention. DETAILED DESCRIPTION
[0060] In the NVMe (Non-Volatile Memory express) protocol, different IO command types are defined. For some IO commands, there is no requirement for the order between IO commands. For example, if a read command for logical address x is submitted, and a write command for logical address x is also submitted, although the execution result of the write command will affect the execution result of the read command, if the order between the two IO commands is not required, the NVMe protocol allows the solid-state storage device to execute the two IO commands in any order.
[0061] In view of this feature of the NVMe protocol, in an embodiment of the present invention, the processing method of IO requests is improved to enhance the IO command processing capability of the solid-state storage device and reduce the processing delay of IO commands. Those skilled in the art will appreciate that although the embodiment of the present invention is described using the NVMe protocol as an example, the embodiment of the present invention can also be implemented in other protocols that do not require the execution order between IO commands.
[0062] See also Figure 3A , showing a schematic diagram of a control unit of a storage device according to an embodiment of the present invention accessing an FTL table. The control unit 304 of the solid state drive includes a plurality of CPUs (CPU 310, CPU 312, and CPU 314), each of which can access an FTL table external to the control unit 304. The FTL table is stored in, for example, a DRAM (Dynamic Random Access Memory). The CPU of the control unit also accesses the NVM chip through a flash memory interface (not shown). As an example, the CPU 310 processes a write command from the host, and accesses the FTL table entry 324 (given by the logic address indicated by the write command) at time t1. Figure 3A To avoid multiple write commands writing to the same logical address at the same time, a lock corresponding to the entry is also requested when accessing the FTL entry. Figure 3AIn the example of FIG. 3 , the CPU 310 accesses the lock 334 corresponding to the FTL table entry 324. In the example of FIG. 3 , the lock 334 indicates that the FTL table entry 324 is not locked, and the CPU 310 modifies the lock 334 to indicate that the FTL table entry 324 is locked. In an embodiment of the present invention, when processing a write command, a lock of the FTL table entry that the write command will modify is acquired. When the lock cannot be acquired, the processing of the write command is temporarily suspended and waits for the lock to be released. Figure 3A In the example, after time t1, CPU 310 obtains the lock of FTL entry 324. At this time, when other CPUs want to access FTL entry 324 to process a write command, they find that lock 334 indicates that FTL entry 324 is locked, so they stop processing the write command to access FTL entry 324.
[0063] Still see Figure 3A , CPU 314 processes the read command from the host, and accesses FTL entry 324 at time t2 according to the logical address of the read command. Although FTL entry 324 has been locked, in an embodiment of the present invention, CPU 314 ignores the lock of FTL entry 324, still obtains FTL entry 324, and obtains the physical address to be accessed according to FTL entry 324. Further, CPU 314 or other CPUs read data through the physical address and provide the read data to the host as a response to the read command. Since it is not checked whether the FTL entry 324 is locked when processing the read command, the write command accessing the FTL entry 324 and one or more read commands accessing the FTL entry 324 can be executed simultaneously, thereby improving the parallel processing capability of IO commands. And since there is no need to wait for the lock of the FTL entry 324 to be released when processing the read command, the time for processing the read command is reduced.
[0064] exist Figure 3AIn the example, to process the write command, the CPU 310 allocates a new physical address for the write command and updates the FTL entry 324 with the new physical address. At time t3, the CPU 310 completes the update of the FTL entry 324 (indicated by W-t3 in FIG. 3). And also writes data to the new physical address to respond to the write command. Data can be written to the new physical address by the CPU 310 or other CPUs. Therefore, at time t2 before time t3, the CPU 314 obtains the old physical address from the FTL entry 324, and after time t3, the new physical address is obtained from the FTL entry 324 in response to the read command (updated by the CPU 310 when processing the write command). Therefore, when processing the read command, if the CPU 314 accesses the FTL entry 324 before time t3, it will obtain a different physical address than the FTL entry 324 after time t3, and then read different data. Such a result is consistent with protocols such as the NVMe protocol that do not require the processing order of IO commands.
[0065] In one example, the lock 334 and the FTL entry 324 are stored separately from each other. To process a read command, the CPU 314 accesses the FTL entry 324 without accessing the lock 334. In another example, the lock 334 and the FTL entry 324 are stored in the same storage location. When processing a read command, the CPU 314 accesses the FTL entry 324 and obtains the content of the lock 334, but the CPU 314 does not need to process the content of the lock 334, and only cares about the physical address provided by the FTL entry 324.
[0066] Continue to view Figure 3A The granularity of the lock is for each FTL table entry. In response to the IO command, the CPU 312 accesses the FTL table entry 328. For a read command, the CPU 312 ignores the lock 338 corresponding to the FTL table entry 328; for a write command, the CPU 312 checks the lock 338 corresponding to the FTL table entry 328, and only continues to process the write command when the lock 338 indicates that the FTL table entry 328 is not locked. When the lock 338 indicates that the FTL table entry 328 is locked, the processing of the write command is suspended, or the update of the FTL table entry 328 is postponed.
[0067] Figure 3B 3 is a schematic diagram of a control unit of a storage device according to another embodiment of the present invention accessing an FTL table. A read command or a write command from a host accesses data of different lengths and accesses different numbers of FTL table entries. In an embodiment of the present invention, the granularity of locking is each FTL table entry. For example, CPU 310 processes a write command from a host, and the write command accesses three logical addresses. According to the logical address indicated by the write command, CPU 310 accesses FTL table entry 320, FTL table entry 322, and FTL table entry 324 (referred to as FTL table entry 325) at time t1. Figure 3B The CPU 310 also requests the lock corresponding to the FTL entry when accessing the FTL entry, and requests the locks corresponding to the FTL entry 320, the FTL entry 322, and the FTL entry 324 by accessing the lock 330, the lock 332, and the lock 334. When the corresponding lock is acquired, the CPU 310 performs subsequent operations, allocates a new physical address, and updates the corresponding FTL entry with the new physical address. When the corresponding lock cannot be acquired, the CPU 310 terminates the operation on the corresponding FTL entry and waits for the corresponding lock to be released. For example, if CPU 310 obtains the locks of FTL table entry 320 and FTL table entry 322, but does not obtain the lock of FTL table entry 324, then CPU 310 continues to process and update FTL table entry 320 and FTL table entry 322, and suspends the operation on FTL table entry 324 until the lock 334 of FTL table entry 324 is released and obtained by CPU 310, and CPU 310 continues to update FTL table entry 324. In response to the FTL table entry being updated, data is also written to the new physical address to respond to the write command. When the new physical addresses of the three FTL table entries corresponding to the write command are all written with data, the write command processing is completed.
[0068] Still see Figure 3B , CPU 314 processes the read command from the host and accesses FTL entry 324 at time t2 according to the logical address of the read command (at Figure 3B In the embodiment of the present invention, the CPU 314 ignores the lock of the FTL entry 324, still obtains the FTL entry 324, and obtains the physical address to be accessed according to the FTL entry 324. Further, the CPU 314 or other CPUs read data through the physical address and provide the read data to the host as a response to the read command. Since the FTL entry 324 is not checked whether it is locked when processing the read command, the write command accessing the FTL entry 324 and one or more read commands accessing the FTL entry 324 can be executed simultaneously, thereby improving the parallel processing capability of the IO command. And since there is no need to wait for the lock of the FTL entry 324 to be released when processing the read command, the time for processing the read command is reduced.
[0069] Figure 3C FIG. 1 is a schematic diagram of a control unit of a storage device accessing an FTL table according to yet another embodiment of the present invention. Figure 3C In the embodiment shown, multiple IO commands can be processed in parallel on the same CPU. For example, CPU 310 processes a write command from the host, and according to the logical address indicated by the write command, CPU 310 accesses FTL table entry 324 (by Figure 3C When accessing the FTL table entry, CPU 310 also requests the lock corresponding to the table entry, and requests the lock corresponding to FTL table entry 324 by accessing lock 334. When the corresponding lock is obtained, CPU 310 performs subsequent operations, allocates a new physical address, and updates the corresponding FTL table entry 324 at time t3 with the new physical address (indicated by W1-t2). Figure 3C W3-t3 indicates an update to the FTL table entry 324). Between times t1 and t3, the CPU 310 also responds to a read command from the host and accesses the FTL table entry 324 at time t2. Although at time t2, the lock 334 indicates that the FTL table entry 324 is locked, for a read command, even if there is a lock on the FTL table entry 324, the CPU 310 still accesses and uses the FTL table entry 324, and reads data using the physical address provided by the FTL table entry 324. In a further embodiment, the CPU 310 caches the FTL table entry 324 obtained at time t1, and obtains the content of the FTL table entry 324 from the cache of the CPU 310 at time t2. And for processing a read command, regardless of whether the FTL table entry 324 cached by the CPU 310 is updated, the data is read using the physical address provided by the cached FTL table entry 324. At time t2, the CPU 314 accesses the FTL table entry 324 in response to the logical address of another read command ( Figure 3C Since it is a read command, although the lock 334 indicates that the FTL entry 324 is locked, the CPU 314 still accesses and uses the FTL entry 324 and reads the data using the physical address provided by the FTL entry 324.
[0070] Figure 4A 4 is a flowchart of accessing an FTL table for processing a write command according to an embodiment of the present invention. In an embodiment of the present invention, in response to receiving a write command (410) to access a logical address of a first FTL table entry, it is checked whether the first FTL table entry is locked (420). If the first FTL table entry is locked, subsequent processing of the first FTL table entry is terminated, and the lock of the first FTL table entry is waited to be released. The subsequent processing of the first FTL table entry is part of the processing of the write command. If the first FTL table entry is not locked, or the lock of the first FTL table entry is released, to process the write command, the first FTL table entry is locked (430) so that other write commands accessing the first FTL table entry are temporarily suspended. To process the write command, a first physical address is assigned to the write command, the first FTL table entry is updated with the first physical address, the updated FTL table entry is written into the FTL table, and the first FTL table entry is unlocked (440). The assignment of a new physical address to the write command can be performed using a variety of methods known in the art. And the data corresponding to the write command is written into the first physical address (450).
[0071] In another example, when accessing the first FTL table entry corresponding to the logical address of the write command in response to receiving a second write command, it is found that the first FTL table entry is locked, and the processing of the second write command is completed without allocating a physical address for the second write command or writing the data corresponding to the second write command into the non-volatile memory.
[0072] Figure 4B 4 is a flowchart of accessing the FTL table for processing a write command according to an embodiment of the present invention. In response to receiving a read command, the logical address of the read command corresponds to the first FTL table entry (432). For the read command, it is not checked whether the first FTL table entry is locked. Even if the first FTL table entry has been locked (see FIG. 4 ) due to processing the write command, the first FTL table entry is locked. Figure 4A In step 430), when processing a read command, the locked first FTL table entry (434) is also obtained from the FTL table and used. And data is read out according to the first physical address (436) as a response to the read command.
[0073] In another example, when the first FTL table entry is obtained to process a read command, if the first FTL table entry is locked, it indicates that there is an executing write command accessing the first FTL table, and the data to be written by the write command is in the cache. The data to be written by the write command accessing the first FTL table is searched from the cache as the read data of the read command. The speed of obtaining data from the cache is much faster than the speed of obtaining data from the non-volatile memory chip, so the cached data to be written is used as a response to the read command, further reducing the processing time of the read command.
[0074] Figure 5A FIG. 4 is a schematic diagram of a control unit of a storage device accessing an FTL table according to another embodiment of the present invention.
[0075] The control unit 504 of the solid state drive includes a plurality of CPUs (CPU 510, CPU 512, CPU 514), each of which can access the FTL table external to the control unit 304. The CPU of the control unit also accesses the NVM chip 505 through the flash memory interface. The NVM chip 505 includes a plurality of storage units, such as storage unit 550, storage unit 552, storage unit 560, and storage unit 562. For example, the CPU 510 processes a write command from a garbage collection task and accesses the FTL table entry 524 (given by the memory 524) at time t1 according to the logical address indicated by the write command. Figure 5A To avoid multiple write commands writing to the same logical address at the same time, a lock corresponding to the entry is also requested when accessing the FTL entry. Figure 5A In the example of , CPU 510 accesses lock 534 corresponding to FT L entry 524. Figure 5AIn the example of FIG. 5 , CPU 510 modifies lock 534 to indicate that FTL entry 524 is locked.
[0076] Still see Figure 5A , CPU 514 processes the read command from the host and accesses FTL entry 524 (at time t2) according to the logical address of the read command. Figure 5A Although the FTL table 5324 has been locked, in the embodiment according to the present invention, when processing a read command, the CPU 514 ignores the lock of the FTL table entry 524, still obtains the FTL table entry 524, and obtains the physical address to be accessed according to the FTL table entry 524. The CPU 514 accesses the physical address of the NVM chip 505 through the flash memory interface according to the obtained physical address, and obtains the data to be read.
[0077] exist Figure 5A In the example of FIG. 5 , to process the write command from the garbage collection task, the CPU 510 allocates a new physical address for the write command and updates the FTL entry 524 with the new physical address. At time t3, the CPU 510 completes the update of the FTL entry 524 ( Figure 5A t3 in FIG. 1 ), and also writes data to a new physical address in response to a write command.
[0078] In some cases, when the CPU 514 processes a read command, the accessed physical address is a physical block in an erased state in the NVM chip 505. The physical block in an erased state does not have valid data and should not be read. Figure 5B According to the present invention Figure 5A A sequence diagram of processing an IO request in an embodiment, which shows why the CPU 514 reads the erase block in the NVM chip 505. Figure 5B In FIG. 5 , the time axis shows the direction of time flow. In response to the garbage collection (GC) write command 560, the CPU 510 accesses the FTL table entry 524 (referred to by Figure 5A The FTL table entry 524 is locked, and the physical address of the FTL table 524 indicates the storage unit 550 of the NVM chip 505. In the process of processing the GC write command (560), the FTL table entry 524 is updated by the CPU 510, and the updated physical address of the FTL table entry 524 indicates the storage unit 560.
[0079] After the FTL table entry 524 is locked, a user read command (570) is received, and the CPU 514 processes the user read command (570) and obtains the FTL table entry 524. Since the CPU 514 ignores the lock 534 of the FTL table entry 524 when obtaining the FTL table entry 524, and the timing of obtaining the FTL table entry 524 is before the FTL table entry 524 is updated by the CPU 510, the physical address obtained from the FTL table entry 524 indicates the storage unit 550.
[0080] Continue to view Figure 5B , after the GC write command (560), the GC erase command (562) will follow, and in response to the GC erase command (562), the old physical address (storage unit 550) affected by the GC write command (560) will be erased. As a result, the storage unit 550 of the NVM chip is in an erased state. The CPU 514 obtains the old FTL table entry 524 to process the user read command (570), and issues a read command to the storage unit 550 through the flash memory interface. The CPU 514 issues a read command to the storage unit 550 and the CPU 510 issues an erase command to the storage unit 550. These two operations may occur in an arbitrary order, so that when the CPU 514 issues a read command, the storage unit 550 may be in an erased state, so that the read command cannot be processed correctly.
[0081] In an embodiment according to the present invention (see Figure 5A), to solve the above problem, the control component 504 also maintains a block status table 540. In the block status table 540, it is recorded whether each physical block of the NVM chip 550 is in an erased state or in a written state. In one example, when a physical block is erased, the block status table 540 is updated to indicate that the physical block is in an erased state. When a physical block is written for the first time, the block status table 540 is updated to indicate that the physical block is in a written state. Before the CPU 514 issues a read command to the NVM chip 505 through the flash memory interface, it uses the physical address obtained from the FTL table entry 524 to obtain the physical block where the physical address is located, and queries the state of the physical block in the block status table 540. If the physical block is in a written state, the CPU 514 issues a read command to the NVM chip 505 through the flash memory interface; if the physical block is in an erased state, the CPU 514 instructs to replay the read command. As an example, the meaning of replaying the read command is that the control component 504 regards the read command as a newly received read command and reprocesses it. Since reprocessing takes time, when the FTL table entry 524 is re-acquired, its content is likely to have been updated, and the newly acquired FTL table entry 524 will provide an updated physical address, and valid data is stored in the updated physical address. In rare cases, as an example, when the FTL table entry 524 is re-acquired, the update of the FTL table entry 524 is still not completed, and the re-acquired FTL table entry is still the old physical address in the erased state. In this case, in one example, the read command is replayed again to re-acquire the FTL table entry 524; and in another example, the CPU 514 further identifies the lock 534 corresponding to the FTL table entry 524. If the lock 534 indicates that the FTL table entry 524 is locked, the CPU 514 waits for the lock 534 to be released to obtain the updated FTL table entry 524, and then uses the physical address provided by the updated FTL table entry 524 to access the NVM chip 505; if the lock 534 indicates that the FTL table entry 524 is not locked, the physical address provided by the FTL table entry 524 is immediately used to access the NVM chip 505.
[0082] Figure 6 FIG. 4 is a schematic diagram of organizing physical blocks of an NVM into block stripes according to an embodiment of the present invention. Figure 6 In the solid-state storage device shown, a block stripe is constructed on every 16 logical units (LUN0, LUN1, ..., LUN15), and physical blocks with the same physical address in each logical unit constitute a "block stripe".
[0083] Figure 6In the example, block B0 with address 0 in LUN0-LUN15 constitutes block stripe 0, wherein physical block B0 of LUN0 to LUN14 is used to store user data, and physical block B0 of LUN15 is used to store check data calculated based on the user data in the block stripe. The physical block of NVM includes multiple pages, and the physical pages with the same address in the block stripe constitute a page stripe, and check data is calculated for each page stripe. For example, each physical page of physical block B0 of LUN15 stores check data calculated based on all user data of the page stripe where the physical page is located.
[0084] Similarly, Figure 6 In the example, the physical block B2 at address 2 in LUN0-LUN15 is in block stripe 2. Optionally, the physical block used to store the check data may be located in any LUN in the block stripe. Figure 6 In the example of FIG. 1 , by using the check data in the block stripe, when the data of one physical page of the block stripe is damaged, the data of the damaged page can be recovered from other pages of the page stripe where the physical page is located.
[0085] Those skilled in the art will appreciate that a block stripe can be constructed in a variety of other data organization methods. A block stripe includes multiple physical blocks, and data protection is provided in the block stripe through redundancy or RAID technology. Therefore, in the event that one or more physical blocks in the block stripe are damaged, the data of the damaged physical block can be reconstructed through other blocks of the block stripe. Erasing is performed in units of block stripes. When performing an erase operation, all physical blocks belonging to the block stripe are erased together.
[0086] Figure 7 FIG. 2 is a schematic diagram of a control component of a storage device accessing an FTL table according to yet another embodiment of the present invention. Figure 5A In comparison, Figure 7 In the embodiment of the present invention, the control component 504 further includes a CPU 516, and the NVM 705 includes a block stripe 750, a block stripe 752, a block stripe 754, and a block stripe 756, and a block stripe status table 740 that records the status of each block stripe. In the block stripe status table 740, a plurality of entries (entry 760, entry 762, entry 764, and entry 766) are included, each entry recording whether the corresponding block stripe of the NVM 705 is in an erased state or in a written state. In one example, when the block stripe is erased, the block stripe status table 740 is updated to indicate that the block stripe is in an erased state. When the block stripe is written for the first time, the block stripe status table 740 is updated to indicate that the physical block is in a written state.
[0087] exist Figure 7In the embodiment of the processor read command, the CPU 514 accesses the FTL table entry 524 and provides the physical address provided by the FTL table entry 524 to the CPU 516. The CPU 516 issues a read command to the NVM 705 through the flash memory interface. Before the CPU 516 issues a read command to the NVM 705 through the flash memory interface, it uses the physical address obtained from the FTL table entry 524 to obtain the block stripe where the physical address is located, and queries the status of the block stripe in the block stripe status table 740. If the block stripe is in a written state, the CPU 516 issues a read command to the NVM 705 through the flash memory interface; if the physical block is in an erased state, the CPU 516 instructs to replay the read command. In rare cases, as an example, when the FTL table entry 524 is re-acquired, the update of the FTL table entry 524 is still not completed, and the re-acquired FTL table entry still provides the old physical address in an erased state. In this case, in one example, the read command is replayed again to reacquire the FTL table entry 524; and in another example, the CPU 516 further identifies the lock 534 corresponding to the FTL table entry 524. If the lock 534 indicates that the FTL table entry 524 is locked, the CPU 614 waits for the lock 534 to be released to acquire the updated FTL table entry 524, and then provides the physical address provided by the updated FTL table entry 524 to the CPU 516; if the lock 534 indicates that the FTL table entry 524 is not locked, the physical address provided by the FTL table entry 524 is immediately provided to the CPU 516.
[0088] Fig. 8A 8 is a flowchart of accessing an FTL table for processing a write command according to another embodiment of the present invention. In the embodiment according to FIG. 8 , in response to receiving a write command (802) for accessing a logical address of a first FTL table entry, it is checked whether the first FTL table entry is locked (804). If the first FTL table entry is locked, subsequent processing of the first FTL table entry is terminated, and the lock of the first FTL table entry is waited for to be released. The subsequent processing of the first FTL table entry is part of the processing of the write command. If the first FTL table entry is not locked, or the lock of the first FTL table entry is released, to process the write command, the first FTL table entry is locked (806) so that other write commands accessing the first FTL table entry are temporarily suspended. To process the write command, a first physical address is assigned to the write command, the first FTL table entry is updated with the first physical address, the updated FTL table entry is written into the FTL table, and the first FTL table entry is unlocked (808). The assignment of a new physical address to the write command can be performed using a variety of methods known in the art. And the data corresponding to the write command is written into the first physical address (809).
[0089] In another example, when accessing the first FTL table entry corresponding to the logical address of the write command in response to receiving a second write command, it is found that the first FTL table entry is locked, and the processing of the second write command is completed without allocating a physical address for the second write command or writing the data corresponding to the second write command into the non-volatile memory.
[0090] Figure 8B FIG. 8 is a flowchart of accessing the FTL table for processing a write command according to another embodiment of the present invention. In response to receiving a read command, the logical address of the read command also corresponds to the first FTL table entry (810). For the read command, it is not checked whether the first FTL table entry is locked. Even if the first FTL table entry has been locked (see FIG. 8 ) due to processing a write command, the first FTL table entry is locked. Fig. 8A Step 806), when processing the read command, the first locked FTL table entry is also obtained from the FTL table and used to obtain the first physical address provided by the first FTL table entry (820). Next, the corresponding physical block or block stripe is obtained according to the first physical address, and the physical block or block stripe is obtained from the block status table (see Figure 5A , 540) or block stripe status table (see Figure 7 , 740) to obtain the state of the corresponding physical block or block stripe. If the obtained state indicates that the physical block or block stripe where the first physical address is located is in an erased state (830), the read command is replayed. In other words, the read command is reprocessed through step 810. If the obtained state indicates that the physical block or block stripe where the first physical address is located is in a written state (830), data is read from the first physical address to respond to the read command (840).
[0091] Fig. 9A 1 is a flow chart of accessing the FTL table for processing IO commands according to an embodiment of the present invention. Fig. 9A In an embodiment, in response to receiving a read command, the logical address of the read command corresponds to the first FTL table entry (910). For the read command, it is not checked whether the first FTL table entry is locked. Even if the first FTL table entry has been locked due to processing a write command, when processing the read command, the locked first FTL table entry is obtained and used from the FTL table to obtain the first physical address provided by the first FTL table entry (920). Next, a read command is sent to the NV M according to the first physical address to read data from the first physical address (920). Indicate in the result of reading the data whether the physical page corresponding to the first address is in an erased state (930). In one example, the NVM chip provides such an indication in the result of reading the data to identify whether the read physical page is in an erased state. In another example, the flash memory interface of the control component determines whether the read data comes from a physical page in an erased state based on the data read from the NVM chip.
[0092] Continue to view Fig. 9AIf the result of reading the data indicates that the physical page corresponding to the first physical address is in an erased state, return to step 910 and replay the read command. If the result of reading the data indicates that the physical page corresponding to the first physical address is not in an erased state, the read data is valid, and the read data is used as a response to the read command, and the read command processing is completed (940).
[0093] exist Fig. 9A In the embodiment, after obtaining the first physical address, it is not checked whether the physical block or block stripe where the first physical address is located is in the erased state. Therefore, the probability that the physical block or block stripe where the first physical address is located is in the erased state is very low. In most cases, the operation of checking whether it is in the erased state will introduce additional delay. Fig. 9A In the embodiment, after obtaining the first physical address, it is not checked whether the physical block or block stripe where the first physical address is located is in the erased state, but data is directly read from the first physical address, and it is determined whether the read physical page is in the erased state based on the indication provided by the read data result. Therefore, additional processing is performed only when the read physical page is in the erased state, thereby reducing the average processing delay of the read command.
[0094] Fig. 9B is a flowchart of accessing the FTL table for processing an IO command according to yet another embodiment of the present invention. Fig. 9B The embodiment of Fig. 9A The embodiment of the present invention is similar to the embodiment of the present invention, except that when data is read from a first physical address, it is determined in the result of reading the data whether the physical page corresponding to the first address is in an erased state (980). If the result of reading the data indicates that the physical page corresponding to the first physical address is in an erased state, the corresponding physical block or block stripe is obtained according to the first physical address, and the physical block or block stripe is obtained from the block status table (see Figure 5A , 540) or block stripe status table (see Figure 7 , 740) to obtain the status of the corresponding physical block or block stripe (990). If the physical block or block stripe where the first physical address is located is in the written state (990), then the result of reading data from the first physical address indicates that the physical page is in the erased state, which has nothing to do with whether the first FTL table entry is locked, but the data stored in the first physical address is damaged, indicating that the read command processing failed as a response to the read command (995). If the physical block or block stripe where the first physical address is located is in the erased state (990), return to step 950 to replay the read command. When reading data from the first physical address, it is determined in the result of reading the data whether the physical page corresponding to the first address is in the erased state (980). If the result of reading the data indicates that the physical page corresponding to the first physical address is not in the erased state, the read data is used as a response to the read command, and the read command processing is completed (985).
[0095] Still see Fig. 9B In another example, when step 980 is performed for the first time, data is read from the first physical address for the first time, and it is determined in the result of reading the data that the physical page corresponding to the first address is in an erased state (980), Fig. 9B As shown by the dotted line in the figure, the read command is directly replayed. For the same read command, due to being replayed, when passing step 980 for the second time, if it is determined in the result of reading the data that the physical page corresponding to the first address is in the erased state (980), then step 990 is entered, and the block status table (see Figure 5A , 540) or block stripe status table (see Figure 7 , 740) to obtain the status of the corresponding physical block or block stripe.
[0096] exist Fig. 9B In an embodiment, when a physical page to be read is in an erased state, a different processing strategy is adopted to obtain better error handling efficiency.
[0097] Fig. 9C is a flowchart of accessing the FTL table for processing an IO command according to yet another embodiment of the present invention. Fig. 9B The embodiment of Fig. 9C The embodiment of the present invention is similar to that of the embodiment of the present invention, except that when data is read out from the first physical address, it is determined in the result of reading the data whether the physical page corresponding to the first address is in an erased state (980), and it is queried whether the first FTL table entry is locked (992). If the first FTL table entry is not locked (992), the result of reading the data from the first physical address indicates that the physical page is in an erased state, which has nothing to do with whether the first FTL table entry is locked, but the data stored in the first physical address is damaged, indicating that the read command processing failed as a response to the read command (995). If the first FTL table entry is locked (992), the result of reading the data from the first physical address indicates that the physical page is in an erased state, which is related to the locking of the first FTL table entry, and the lock of the first FTL table entry is waited to be released, and the first FTL table entry is acquired again and the second physical address provided by the updated first FTL is obtained (994). And an access command is issued to the NVM with the second physical address, and data is read out from the second physical address of the NVM (996) as a response to the read command.
[0098] Still see Fig. 9C In another example, when step 980 is performed for the first time, data is read from the first physical address for the first time, and it is determined in the result of reading the data that the physical page corresponding to the first address is in an erased state (980), Fig. 9CAs shown by the dotted line in , the process returns to step 950 and directly replays the read command. For the same read command, due to being replayed, when passing step 980 for the second time, if it is determined in the result of reading the data that the physical page corresponding to the first address is in the erased state (980), the process proceeds to step 992 to check whether the first FTL table entry is locked and perform subsequent processing.
[0099] exist Fig. 9C In an embodiment, when a physical page to be read is in an erased state, a different processing strategy is adopted to obtain better error handling efficiency.
[0100] Fig. 10A FIG. 4 is a schematic diagram of a control unit of a storage device accessing an FTL table according to another embodiment of the present invention. Fig. 10A In the embodiment, the control unit 1004 of the solid state drive includes a plurality of CPUs (CPU 1010, CPU 1012, CPU 1014), each of which can access the FTL table external to the control unit 1004. The CPU of the control unit also accesses the NVM chip 1005 through the flash memory interface. The NVM chip 1005 includes a plurality of storage units, such as storage unit 1050, storage unit 1052, storage unit 1060, and storage unit 1062. As an example, CPU 1010 processes a write command. The write command may come from the host or from a garbage collection operation or other request to write data. The FTL table entry 1024 (given by the write command) is accessed at time t1 according to the logical address indicated by the write command. Fig. 10A To avoid multiple write commands writing to the same logical address at the same time, a lock corresponding to the entry is also requested when accessing the FTL entry. Fig. 10A In the example of , CPU 1010 accesses lock 1034 corresponding to FTL entry 1024. Fig. 10A In the example of , CPU 1010 modifies lock 1034 to indicate locking of FTL entry 1024.
[0101] exist Fig. 10A In the example of FIG. 1 , to process the write command, the CPU 1010 allocates a new physical address for the write command and updates the FTL entry 524 with the new physical address. At time t2, the CPU 1010 completes the update of the FTL entry 1024 ( Fig. 10A and also responds to a write command by writing data to a new physical address via the flash memory interface (in Fig. 10A (indicated by W-t5 in the figure).
[0102] Still see Fig. 10A, CPU 1014 processes the read command from the host and accesses FTL entry 1024 at time t3 according to the logical address of the read command (in Fig. 10A The CPU 1014 accesses the NVM chip 1005 (in the case of the NVM chip 1005) through the flash memory interface according to the obtained physical address. Fig. 10A t4 in the figure).
[0103] exist Fig. 10A In the example, CPU 1014 obtains FTL entry 1024 (in Fig. 10A t3 in the figure) occurs after CPU 1010 updates FTL entry 1024 ( Fig. 10A t2), so the CPU 1014 obtains the updated FTL table entry 1024. However, the CPU 1014 accesses the N VM chip (in Fig. 10A t4 in the figure) occurs when CPU 1010 writes data to a new physical address through the flash memory interface (in Fig. 10A Therefore, the possible result is that when the CPU 1014 accesses the NVM chip 1005 through the flash memory interface using the physical address provided by the FTL table entry 1024, the storage unit accessed by the physical address has not been written to the data and may be in an erased state. The physical block in the erased state does not have valid data and should not be read.
[0104] Fig. 10B According to the present invention Fig. 10A A sequence diagram of processing IO requests in an embodiment, which shows the reason why CPU 1014 reads the erased storage unit in NVM chip 1005. Fig. 10B In FIG. 1 , the time axis shows the direction of time flow. In response to the write command 1060, the CPU 1010 accesses the FTL table entry 1024 (referred to as Fig. 10A The FTL table entry 1024 is locked, and the physical address of the FTL table 1024 indicates the storage unit 1050 of the NVM chip 1005. In the process of processing the write command (1060), the FTL table entry 1024 is then updated by the CPU 1010, and the updated physical address of the FTL table entry 1024 indicates the storage unit 1060. And optionally, the lock of the FTL table entry 1024 is released.
[0105] Next, upon receiving a user read command (1070), CPU 1014 processes the user read command (1070) and obtains FTL entry 1024. Since CPU 1014 obtains FTL entry 1024 after FTL entry 1024 is updated by CPU 1010, the physical address obtained from FTL entry 1024 indicates storage unit 1060.
[0106] Continue to view Fig. 10B At time t4, the CPU 1014 issues a read command to the NVM chip 1005 to read the physical address 1060 of the NVM chip 1005 (see also Fig. 10A and at time t5 after time t4, the CPU 1010 issues a write command to the physical address 1060 of the NVM chip 1005 (see also Fig. 10A Before receiving the write command to the physical address 1060, the NVM chip 1005 has received the read command to the physical address 1060.
[0107] However, before the physical address 1060 of the NVM chip 1005 is written, it is in an erased state, and the read command cannot be correctly processed by the flash memory interface. In the prior art, the minimum erase unit of an NVM storage medium such as a flash memory is a block, and the minimum read / write unit is a page, and a block includes multiple pages. Therefore, in the NVM chip 1005, there may be a state in which some pages in a block have been written with data, while other pages are still in an erased state.
[0108] In an embodiment according to the present invention (see Fig. 10A), to solve the above problem, the control component 1004 also maintains a write position table 1042. The write position table 1042 records the current position to be written in the block or block stripe currently being written. The current position to be written can be a page in a physical block (indicated by a page address or a page number), or it can be a position to be written in a page stripe in a block stripe. And in an embodiment of the present invention, when responding to a write command, the control component 1004 sequentially assigns the physical address to be written to the write command. For example, the current write position is the 100th page of the 100th block of the N VM chip 1005. When assigning a physical address to the write command, the physical address of the 100th page of the 100th block is assigned to the write command, and the assigned physical address is recorded in the table entry of the FTL table, and the current write position is incremented (to the 101st page of the 100th block). When responding to the write command again, the physical address of the new current write position (the 101st page of the 100th block) is assigned to the write command. Optionally, the control component 1004 writes data to only one or a small number of physical blocks at the same time, so only one or a small number of table entries need to be provided in the write position table 1042, and a large amount of storage space will not be occupied. In another example, the current write position indicates the logical unit (LUN) to be currently written in the page stripe, such as the page corresponding to the third logical unit of the 100th page stripe of the 100th block stripe. When allocating a physical address to a write command, the physical address of the page corresponding to the third logical unit of the 100th page stripe of the 100th block stripe is allocated to the write command, and the allocated physical address is recorded in the table entry of the FTL table, and the current write position is incremented (to the page corresponding to the fourth logical unit of the 100th page stripe of the 100th block stripe). When responding to the write command again, the physical address of the new current write position (the page corresponding to the fourth logical unit of the 100th page stripe of the 100th block stripe) is allocated to the write command. Optionally, the control component 1004 writes data to only one or a small number of block stripes at the same time, and thus, only one or a small number of table entries need to be provided in the write position table 1042, without occupying a large amount of storage space.
[0109] The control component 1004 also maintains a block status table 1040. In the block status table 1040, it is recorded whether each physical block of the NVM chip 1005 is in an erased state or in a written state. In one example, when a physical block is erased, the block status table 1040 is updated to indicate that the physical block is in an erased state. When a physical block is written for the first time, the block status table 1040 is updated to indicate that the physical block is in a written state. Before the CPU 1014 issues a read command to the NVM chip 1005 through the flash memory interface, it uses the physical address obtained from the FTL table entry 1024 to obtain the physical block where the physical address is located, and queries the status of the physical block in the block status table 1040. If the physical block is in a written state, the CPU 1014 issues a read command to the NVM chip 1005 through the flash memory interface; if the physical block is in an erased state, the CPU 1014 instructs to replay the read command.
[0110] Fig.11A is a flowchart of processing a write command according to an embodiment of the present invention. Fig.11A In an embodiment of the present invention, in response to receiving a write command (1102) to access the logical address of the first FTL table entry, it is checked whether the first FTL table entry is locked (1104). If the first FTL table entry is locked, the subsequent processing of the first FTL table entry is terminated, and the lock of the first FTL table entry is waited for to be released. The subsequent processing of the first FTL table entry is part of the processing of the write command. If the first FTL table entry is not locked, or the lock of the first FTL table entry is released, to process the write command, the first FTL table entry is locked (1106) so that other write commands accessing the first FTL table entry are temporarily suspended. To process the write command, a first physical address is assigned to the write command, the first FTL table entry is updated with the first physical address, the updated FTL table entry is written into the FTL table, and the lock on the first FTL table entry is released (1108). The new physical address can be assigned to the write command in a variety of ways known in the art. And the data corresponding to the write command is written to the first physical address (1109).
[0111] In another example, when accessing the first FTL table entry corresponding to the logical address of the write command in response to receiving a second write command, it is found that the first FTL table entry is locked, and the processing of the second write command is completed without allocating a physical address for the second write command or writing the data corresponding to the second write command into the non-volatile memory.
[0112] Fig. 11B 1 is a flowchart of processing a read command according to an embodiment of the present invention. In response to receiving the read command, the logical address of the read command also corresponds to the first FTL table entry (1110). For the read command, it is not checked whether the first FTL table entry is locked. Even if the first FTL table entry has been locked (see Fig.11AIn step 1106), when processing a read command, the locked first FTL table entry is also obtained from the FTL table and used to obtain the first physical address provided by the first FTL table entry (1120). Next, the corresponding physical block or block stripe is obtained according to the first physical address, and the current write position of the physical block or block stripe is compared to see whether it is ahead of the first physical address (1130). The current write position of the physical block or block stripe is obtained from the write position table (see FIG. 10 , write position table 1042), and compared with the first physical address obtained from the first FTL table entry. If the current write position is ahead of the first physical address, it indicates that the first physical address has been written with data, so a read command is issued to the first physical address and data is read out (1140). If the current write position is not ahead of or lags behind the first physical address, it indicates that the first physical address has not been written with data, and the correct data cannot be read from the first physical address at this time, so the processing of the read command is suspended until the current write position is ahead of the first physical address. After the current write position precedes the first physical address, data is read from the first physical address (1140).
[0113] Fig. 11C FIG. 1 is a flowchart of processing an IO command according to another embodiment of the present invention. In response to receiving a read command, the logical address of the read command also corresponds to the first FTL table entry (1150). For the read command, it is not checked whether the first FTL table entry is locked. Even if the first FTL table entry has been locked (see FIG. 1150 ) due to processing a write command, the first FTL table entry is locked. Fig.11A Step 1106), when processing the read command, the first locked FTL table entry is also obtained from the FTL table and used to obtain the first physical address provided by the first FTL table entry (1160). Next, the corresponding physical block or block stripe is obtained according to the first physical address, and the physical block or block stripe is obtained from the block status table (see Figure 5A , 540) or block stripe status table (see Figure 7, 740). If the acquired status indicates that the physical block or block stripe where the first physical address is located is in an erased state (1170), the read command is replayed. In other words, the read command is reprocessed through step 1150. If the acquired status indicates that the physical block or block stripe where the first physical address is located is in a written state (1170), the corresponding physical block or block stripe is acquired according to the first physical address, and the current write position of the physical block or block stripe is compared to see whether it is ahead of the first physical address (1180). The current write position of the physical block or block stripe is acquired from the write position table (see FIG. 10 , write position table 1042), and compared with the first physical address acquired from the first FTL table entry. If the current write position is ahead of the first physical address, it indicates that the first physical address has been written with data, so a read command is issued to the first physical address and the data is read out (1190). If the current write position is not ahead of or behind the first physical address, it indicates that the first physical address has not been written with data yet, and the correct data cannot be read from the first physical address at this time, so the processing of the read command is suspended, and the current write position is waited to be ahead of the first physical address. After the current write position is ahead of the first physical address, data is read from the first physical address (1190).
[0114] Fig. 12A FIG. 1 is a flowchart of processing IO commands according to another embodiment of the present invention. Fig. 12AIn the embodiment of the present invention, in response to receiving a read command, the logical address of the read command corresponds to the first FTL table entry (1210). For the read command, it is not checked whether the first FTL table entry is locked. Even if the first FTL table entry has been locked due to processing a write command, when processing the read command, the locked first FTL table entry is obtained and used from the FTL table to obtain the first physical address provided by the first FTL table entry (1220). Next, a read command is sent to the NVM according to the first physical address to read data from the first physical address (1225). In the result of reading the data, it is indicated whether the physical page corresponding to the first address is in an erased state (1230). If the result of reading the data indicates that the physical page corresponding to the first physical address is in an erased state, it is further determined whether the current write position is ahead of the first physical address (1245). As an example, the corresponding physical block or block stripe is obtained according to the first physical address, and the current write position of the physical block or block stripe is obtained from the write position table (see FIG. 10, write position table 1042). If the current write position is ahead of the first physical address, it indicates that data has been written to the first physical address, so a read command is issued to the first physical address and data is read out (1248). If the current write position is not ahead of or lags behind the first physical address, it indicates that data has not been written to the first physical address, and the correct data cannot be read from the first physical address at this time, so the processing of the read command is suspended, waiting for the current write position to be ahead of the first physical address. After the current write position is ahead of the first physical address, data is read out from the first physical address again (1248). If the result of reading the data indicates that the physical page corresponding to the first physical address is not in an erased state (1230), the read data is valid, and the read data is used as a response to the read command, and the read command processing is completed (1240).
[0115] exist Fig. 12A In the embodiment, after obtaining the first physical address, it is not first checked whether the physical block or block stripe where the first physical address is located is in the erased state. Because the probability that the physical block or block stripe where the first physical address is located is in the erased state is very low, in most cases, the operation of checking whether it is in the erased state will introduce additional delay. Fig. 12A In the embodiment, after obtaining the first physical address, it is not first checked whether the physical block or block stripe where the first physical address is located is in the erased state, but data is directly read from the first physical address, and it is determined whether the read physical page is in the erased state based on the indication provided by the read data result. Therefore, additional processing is performed only when the read physical page is in the erased state, thereby reducing the average processing delay of the read command.
[0116] Fig. 12B is a flowchart of processing IO commands according to another embodiment of the present invention. Fig. 12B The embodiment of Fig. 9AThe embodiment of the present invention is similar to the embodiment of the present invention, except that when data is read from the first physical address, it is determined in the result of reading the data whether the physical page corresponding to the first address is in the erased state (1230), if the result of reading the data indicates that the physical page corresponding to the first physical address is in the erased state, the corresponding physical block or block stripe is obtained according to the first physical address, and the physical block or block stripe is obtained from the block status table (see Figure 5A , 540) or block stripe status table (see Figure 7 , 740) to obtain the status of the corresponding physical block or block stripe 1250). If the physical block or block stripe where the first physical address is located is in a written state (1250), it is further determined whether the current write position is ahead of the first physical address (1260). If the current write position is ahead of the first physical address, it indicates that data has been written to the first physical address, so a read command is issued to the first physical address and the data is read out (1270). If the current write position is not ahead of or lags behind the first physical address, it indicates that data has not been written to the first physical address. At this time, the correct data cannot be read from the first physical address, so the processing of the read command is suspended and the current write position is waited to be ahead of the first physical address. After the current write position is ahead of the first physical address, the data is read out from the first physical address again (1270). If the physical block or block stripe where the first physical address is located is in an erased state (1250), the first FTL table entry is accessed again and the updated second physical address is obtained from the first FTL table entry (1255). And then, the relationship between the second physical address and the current write position is determined (1260) and subsequent processing is performed.
[0117] The embodiment of the present invention further provides a program including program codes. When the program is loaded into a CPU and executed in the CPU, the program enables the CPU to execute one of the methods according to the embodiments of the present invention provided above.
[0118] An embodiment of the present invention further provides a program including program code, which, when loaded into a storage device and executed on the storage device, causes a processor of the storage device to execute one of the methods according to the embodiments of the present invention provided above.
[0119] It should be understood that each block of the block diagram and the flow chart and the combination of blocks of the block diagram and the flow chart can be implemented by various means including computer program instructions, respectively. These computer program instructions can be loaded onto a general-purpose computer, a special-purpose computer or other programmable data control device to produce a machine, so that the instructions executed on the computer or other programmable data control device create a device for implementing the functions specified in one or more flow chart blocks.
[0120] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data control device to function in a particular manner, so that the instructions stored in the computer readable memory can be used to manufacture an article of manufacture including computer readable instructions for implementing the functions specified in one or more flowchart blocks. The computer program instructions may also be loaded onto a computer or other programmable data control device to cause a series of operations to be performed on the computer or other programmable data control device, thereby producing a computer-implemented process, and the instructions executed on the computer or other programmable data control device provide operations for implementing the functions specified in one or more flowchart blocks.
[0121] Thus, the blocks of the block diagrams and flow charts support a combination of means for performing a specified function, a combination of operations for performing a specified function, and a combination of program instruction means for performing a specified function. It should also be understood that each block of the block diagrams and flow charts and the combination of blocks of the block diagrams and flow charts can be implemented by a hardware-based special-purpose computer system that performs the specified function or operation, or by a combination of special-purpose hardware and computer instructions.
[0122] Although the present invention has been described with reference to examples, this is for illustrative purposes only and is not intended to limit the present invention, and changes, additions and / or deletions to the embodiments may be made without departing from the scope of the present invention.
[0123] Those skilled in the art to which these embodiments relate and who benefit from the teachings presented in the above description and associated drawings will recognize many modifications and other embodiments of the invention described herein. Therefore, it should be understood that the invention is not limited to the specific embodiments disclosed, and modifications and other embodiments are intended to be included within the scope of the appended claims. Although specific terms are employed herein, they are used only in a general and descriptive sense and not for the purpose of limitation.
Claims
1. A method for processing an IO request, characterized in that: include: In response to receiving the first read request, accessing a first FTL table entry corresponding to the first read request to obtain a first physical address recorded in the first FTL table entry; If the physical block or large block containing the first physical address is in an erased state, replaying the first read request; and Obtaining the current write position of the physical block or block stripe from the write position table, and if the current write position lags behind the first physical address, suspending the processing of the first read request until the current write position is ahead of the first physical address; If the current write position is ahead of the first physical address, it indicates that data has been written into the first physical address; If the current writing position lags behind the first physical address, it indicates that data has not been written into the first physical address.
2. The method for processing IO requests according to claim 1, wherein The replaying the first read request comprises: Accessing a first FTL table entry corresponding to the first read request, and obtaining a second physical address recorded in the first FTL table entry; If the physical block or the large block including the second physical address is in a written state and if the current write position is ahead of the second physical address, data is read from the second physical address in response to the first read request.
3. A method for processing an IO request, characterized in that: include: In response to receiving a write request, accessing a first FTL table entry corresponding to the write request, and if the first FTL table entry is not locked, locking the first FTL table entry; assigning a first physical address to the write request, updating the first FTL table entry with the first physical address, unlocking the first FTL table entry, writing data to the first physical address, and updating a current write position; In response to receiving a read request, accessing a first FTL table entry corresponding to the read request, and obtaining a first physical address recorded in the first FTL table entry; obtaining a current write position of a physical block or a block stripe from a write position table, and if the current write position lags behind the first physical address, suspending processing of the first read request until the current write position is ahead of the first physical address; if the current write position is ahead of the first physical address, it indicates that data has been written to the first physical address; if the current write position lags behind the first physical address, it indicates that data has not been written to the first physical address; In response to receiving the second write request, if the first FTL table entry is locked, suspending processing of the second write request until the lock of the first FTL table entry is released.
4. The method according to claim 3, wherein: Also includes: After the lock of the first FTL table entry is released, the first FTL table entry is acquired and locked.
5. The method for processing IO requests according to claim 3, wherein: The method further includes: in response to receiving a read request, accessing a first FTL table entry corresponding to the read request, and acquiring a first physical address recorded in the first FTL table entry; and if a physical block containing the first physical address is in an erased state, replaying the read request.
6. The method for processing IO requests according to claim 3, wherein: Also includes: After the current write position precedes the first physical address, data is read from the first physical address in response to the read request.
7. The method for processing IO requests according to claim 3 or 4, wherein allocating a first physical address for the write request comprises taking a current write position as the first physical address and incrementing the current write position.
8. A device for processing IO requests, characterized in that: include: An FTL table entry access module, configured to, in response to receiving a first read request, access a first FTL table entry corresponding to the first read request, and obtain a first physical address recorded in the first FTL table entry; as well as The current write position processing module is used to, if the physical block or large block containing the first physical address is in a written state, obtain the current write position of the physical block or block stripe from the write position table, and if the current write position is ahead of the first physical address, read data from the first physical address to respond to the first read request; if the current write position is ahead of the first physical address, it indicates that the first physical address has been written with data; if the current write position lags behind the first physical address, it indicates that the first physical address has not been written with data.
9. A device for processing IO requests, characterized in that: include: An FTL table entry access module, configured to, in response to receiving a first read request, access a first FTL table entry corresponding to the first read request, and obtain a first physical address recorded in the first FTL table entry; as well as A current write position processing module is used to read data from a first physical address; if the result of reading data from the first physical address indicates that the physical page where the first physical address is located is in an erased state, the current write position of the physical block or block stripe is obtained from a write position table; if the current write position lags behind the first physical address, the processing of the first read request is suspended until the current write position is ahead of the first physical address; if the current write position is ahead of the first physical address, it indicates that the first physical address has been written with data; if the current write position lags behind the first physical address, it indicates that the first physical address has not yet been written with data.
10. A device for processing IO requests, characterized in that: include: An FTL table entry access module, configured to, in response to receiving a first read request, access a first FTL table entry corresponding to the first read request, and obtain a first physical address recorded in the first FTL table entry; as well as A current write position processing module is used to read data from a first physical address; if the result of reading data from the first physical address indicates that the physical page where the first physical address is located is in an erased state, and the physical block or large block containing the first physical address is in a written state, the current write position of the physical block or block stripe is obtained from a write position table; if the current write position lags behind the first physical address, the processing of the first read request is suspended until the current write position is ahead of the first physical address; if the current write position is ahead of the first physical address, it indicates that the first physical address has been written with data; if the current write position lags behind the first physical address, it indicates that the first physical address has not yet been written with data.
11. A device for processing IO requests, characterized in that: include: a write request processing module, configured to, in response to receiving a write request, access a first FTL table entry corresponding to the write request, and if the first FTL table entry is not locked, lock the first FTL table entry; allocate a first physical address to the write request, update the first FTL table entry with the first physical address, unlock the first FTL table entry, write data to the first physical address, and update the current write position; as well as A read request processing module is used to access the first FTL table entry corresponding to the read request in response to receiving a read request, and obtain the first physical address recorded in the first FTL table entry; obtain the current write position of the physical block or block stripe from the write position table, and if the current write position lags behind the first physical address, suspend the processing of the first read request until the current write position is ahead of the first physical address; if the current write position is ahead of the first physical address, it indicates that data has been written to the first physical address; if the current write position lags behind the first physical address, it indicates that data has not yet been written to the first physical address.
12. An information processing device, characterized in that: The method comprises a memory, a processor and a program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the program.
