Message reading method, device, electronic device and storage medium

By introducing a cache queue mechanism into the flash channel controller, the message reading process of the solid-state drive is optimized, the problem of time-consuming internal operations of Nand is solved, and more efficient message reading efficiency is achieved.

CN119025054BActive Publication Date: 2025-02-25INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411535995.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-02-25
Estimated Expiration
2044-10-31

AI Technical Summary

Technical Problem

In the prior art, the message reading efficiency of solid-state drives is low, mainly because the Nand internal operation takes a lot of time, resulting in a large amount of waiting time during the reading and writing process.

Method used

By introducing two cache queues in the flash channel controller, the first cache queue is used to cache the message to be read next time, and the second cache queue is used to cache the message currently being read. The specific steps include migrating messages in the commit queue to the first cache queue within the first read cycle, and migrating these messages to the second cache queue within the second read cycle, and finally in the second read cycle. Batch data transmission is performed at the end.

Benefits of technology

Through this method, the number of operations on NAND is reduced, the read waiting time is saved, and the efficiency of message reading is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025054B_ABST
    Figure CN119025054B_ABST
Patent Text Reader

Abstract

The present invention provides a message reading method, device, electronic device and storage medium, which relate to the field of data processing technology, including: when entering a first reading cycle for executing a read command for a first message, migrating a first header message and a second message of a submission queue to a first cache queue; wherein the second message is a message in the submission queue with the same physical page as the first header message; when entering a second reading cycle for executing a read command for the first header message or any of the second messages, migrating the first header message and the second message cached in the first cache queue to a second cache queue; after the second reading cycle ends, performing batch data transmission on the messages cached in the second cache queue.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a message reading method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of data technology, solid-state drives with faster reading speeds have been more widely used, and the operations of solid-state drives will eventually be converted into the read, write, and erase operations of the corresponding Nand in the solid-state drive.

[0003] In the related art, during the reading and writing process of the solid-state hard disk, the internal operation of Nand is time-consuming. Therefore, how to read the messages in the solid-state hard disk more efficiently has become a problem that needs to be solved urgently in the industry. Summary of the invention

[0004] The present invention provides a message reading method, device, electronic device and storage medium, which are used to solve the problem of how to more efficiently read messages in a solid state hard disk in the prior art.

[0005] The present invention provides a message reading method, which is applied to a flash channel controller and comprises the following steps.

[0006] In the case of entering a first read cycle of executing a read command of a first message, migrating a first header message and a second message of a submission queue to a first cache queue; wherein the second message is a message in the submission queue having the same physical page as the first header message;

[0007] When entering a second read cycle for executing a read command for the first header message or any of the second messages, migrating the first header message and the second message cached in the first cache queue to a second cache queue;

[0008] After the second reading cycle ends, the messages cached in the second cache queue are transmitted in batches.

[0009] According to a message reading method provided by the present invention, in a first reading cycle of executing a read command of a first message, migrating a first header message and a second message of a submission queue to a first cache queue includes:

[0010] Migrating the first header message of the submission queue to the first cache queue;

[0011] Comparing the physical page of the first header message with the physical page of each message in the submission queue one by one;

[0012] When a second message having the same physical page as the first header message is detected, the second message is migrated to the first cache queue, and the second message is deleted from the submission queue to obtain an updated submission queue;

[0013] Or, in the event that a third message having a physical page different from that of the first header message is detected, the third message is retained in the submission queue.

[0014] According to a message reading method provided by the present invention, after the step of migrating the first header message and the second message cached in the first cache queue to the second cache queue, the method further includes:

[0015] Migrate the second header message and the fourth message of the updated submission queue to the first cache queue; wherein the fourth message is a message in the submission queue that has the same physical page as the second header message;

[0016] When entering a third read cycle for executing a read command for the second header message or any of the fourth messages, migrating the second header message and the fourth message cached in the first cache queue to the second cache queue;

[0017] After the third reading cycle ends, the messages cached in the second cache queue are transmitted in batches.

[0018] According to a message reading method provided by the present invention, after migrating the first header message of the submission queue to the first cache queue, and comparing the physical page of the first header message with the physical page of each message in the submission queue one by one, the method further includes:

[0019] If there is no second message in the submission queue that has the same physical page as the first header message, no other messages are migrated to the first cache queue in the first read cycle;

[0020] When entering the second reading cycle, the first header message in the first cache queue is migrated to the second cache queue, and the first header message is deleted from the first cache queue.

[0021] According to a message reading method provided by the present invention, after the step of migrating the first header message and the second message of the submitted queue to the first cache queue, the method further includes:

[0022] After the first reading cycle ends, if the first cache queue is not empty, directly obtain the first header message or any of the second messages from the first cache queue;

[0023] Execute a read command of the first header message or any of the second messages to enter a second read cycle.

[0024] According to a message reading method provided by the present invention, executing a read command of the first header message or any of the second messages to enter a second reading cycle includes:

[0025] Parsing the first header message or any of the second messages to determine a read command of the first header message or any of the second messages;

[0026] Send a read command for the first header message or any one of the second messages to enter a second read cycle.

[0027] According to a message reading method provided by the present invention, parsing the first header message or any of the second messages to determine a reading command of the first header message or any of the second messages includes:

[0028] Determine, according to a physical page of the first header message or any one of the second messages, a physical storage location corresponding to the physical page;

[0029] The read command is determined according to a physical storage location corresponding to the physical page.

[0030] According to a message reading method provided by the present invention, after the step of migrating the first header message and the second message of the submitted queue to the first cache queue, the method further includes:

[0031] After the first read cycle ends, if the first cache queue is empty, copy the third header message from the submission queue to the second cache queue;

[0032] The third header message is deleted from the submission queue.

[0033] According to a message reading method provided by the present invention, after the step of migrating the first header message and the second message of the submitted queue to the first cache queue, the method further includes:

[0034] After the first read cycle ends, when the first cache queue is empty and the submission queue is also empty, an idle state is entered.

[0035] According to a message reading method provided by the present invention, after the second reading cycle ends, the messages cached in the second cache queue are transmitted in batches, including:

[0036] Polling the second cache queue, taking out each cached message from the second cache queue one by one, and obtaining the cached messages of the second cache queue;

[0037] Perform a batch data transmission operation on the cached messages of the second cache queue.

[0038] According to a message reading method provided by the present invention, after the step of performing a batch data transmission operation on the cached messages in the second cache queue, the method further includes:

[0039] When the cached message in the second cache queue completes the batch data transmission operation, the completion message corresponding to the cached message in the second cache queue is migrated to the completion queue, and the cached message is deleted from the second cache queue.

[0040] According to a message reading method provided by the present invention, the first cache queue is used to cache messages to be read next time, and the second cache queue is used to cache messages currently being read.

[0041] The present invention also provides a message reading device, comprising the following modules:

[0042] A first migration module is used to migrate a first header message and a second message of a submission queue to a first cache queue when entering a first read cycle of executing a read command of a first message; wherein the second message is a message in the submission queue having the same physical page as the first header message;

[0043] A second migration module is used to migrate the first header message and the second message cached in the first cache queue to the second cache queue when entering a second read cycle of executing a read command of the first header message or any of the second messages;

[0044] The transmission module is used for transmitting the messages cached in the second cache queue in batches after the second reading cycle ends.

[0045] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any one of the message reading methods described above is implemented.

[0046] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the message reading method described in any one of the above is implemented.

[0047] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the message reading method described above is implemented.

[0048] The message reading method, device, electronic device and storage medium provided by the present invention can migrate the first header message at the head of the submission queue to the first cache queue for caching the message to be read next time in advance by the flash channel controller during the waiting period of the previous message reading, and search the submission queue for the second message with the same physical page as the first header message, so as to arrange and integrate the messages with the same physical page. When the data is read subsequently, the data is obtained from the first cache queue preferentially. Only one data reading is required, which can realize batch data transmission of the data in the first cache queue, reduce the number of operations on the NAND, save a lot of reading waiting time, and effectively improve the efficiency of message reading. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 A schematic diagram of the interaction between the flash translation layer and the flash channel controller through queues in the related art;

[0051] Figure 2 A schematic diagram of processing message reading in the related art;

[0052] Figure 3 A schematic diagram of a queue described in an embodiment of the present application;

[0053] Figure 4 It is a flow chart of the message reading method provided by the present invention;

[0054] Figure 5 A schematic diagram of placing a header message in a submission queue into a first cache queue provided in an embodiment of the present application;

[0055] Figure 6 This is a schematic diagram of the queue status in an embodiment of the present application;

[0056] Figure 7 A schematic diagram of message transmission provided in an embodiment of the present application;

[0057] Figure 8 A schematic diagram of batch transmission provided in an embodiment of the present application;

[0058] Fig. 9 A schematic diagram of the structure of a message reading device provided in an embodiment of the present application;

[0059] Fig.10It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0061] In the related art, a dedicated module, Flash Channel Controller (FCC), is usually provided in a solid state drive (SSD) to handle NAND Flash related operations on each channel. These operations include sending commands such as read, write, erase, and set feature according to NAND Flash protocols such as ONFI (Open NAND Flash Interface) or Toggle DDR. Figure 1 FIG. 1 is a schematic diagram of the interaction between the flash translation layer and the flash channel controller through queues in the related art, such as Figure 1 As shown in Figure 1, the communication between FCC and the Flash Translation Layer (FTL) is accomplished through the Submission Queue (SQ) and the Completion Queue (CQ).

[0062] When the host (HOST) needs to read data from the SSD, the FTL first calculates the specific physical location of the data in the NAND Flash. Subsequently, the FTL organizes the read request into an internal message (Message) and puts this message (MSG) into the submission queue (SQ) corresponding to the FCC. After receiving the MSG, the FCC operates the NAND Flash to read the data and puts the processing result into the completion queue (CQ). The FTL receives the completion message from the CQ and returns the processing result and data to the HOST.

[0063] When FCC processes the read request message in the submission queue (SQ), the operation of NAND Flash is mainly divided into two parts: data transfer (Bulk Data Transfer, BDT) and NAND internal operation (Time for Read, tR). Among them, NAND internal operation takes a long time and is the main source of latency. Generally speaking, the average time of tR is about 50 microseconds, but this data may vary depending on the NAND Flash of different manufacturers. In contrast, the time of BDT is about 5 microseconds (us).

[0064] Figure 2 A schematic diagram of processing message reading in the related art, such as Figure 2 As shown in the figure, taking a LUN as an example, when FCC detects that the SQ is empty, it takes out each Read MSG from the queue in turn, performs command parsing, command sending, wait tR, BDT, return CPL and other operations. For each LUN, each Read command is a completely serial operation.

[0065] In the related art, when executing the read command, it is relatively mechanical and rigid, and the command sequence is executed without considering the correlation between the data between the messages. Figure 3 This is a schematic diagram of the queue described in the embodiment of the present application, such as Figure 3 As shown in the figure, there are 5 commands in the SQ queue, among which (MSG1 and MSG3) and (MSG2 and MSG5) have read position correlation. For example, different DataFrames or the same DataFrame of the same physical page are read. Since the commands are executed serially, the same position will be read repeatedly multiple times. Each read will experience tR time, resulting in reduced efficiency.

[0066] Figure 4 is a flow chart of a message reading method provided by the present invention, which is applied to a flash channel controller, such as Figure 4 As shown, the method includes the following:

[0067] Step 410, when entering a first read cycle of executing a read command of a first message, migrate a first header message and a second message of a submission queue to a first cache queue; wherein the second message is a message in the submission queue having the same physical page as the first header message;

[0068] In the embodiment of the present application, in the design of the Flash Channel Controller (FCC), in order to improve the read performance of the solid state drive (SSD), two dedicated read message (READ MSG) cache queues are introduced: the first cache queue PQnext_r and the second cache queue dPQcur_rd. The introduction of these two queues is to optimize the processing flow of the read command, by reducing the number of repeated accesses to the NAND Flash, thereby reducing the read latency (ReadLatency) and improving the overall read efficiency.

[0069] In the embodiment of the present application, the first cache queue PQnext_rd queue is used to cache the message to be read next time.

[0070] In the embodiment of the present application, the second cache queue PQcur_rd queue is used to cache the message currently being read.

[0071] In the embodiment of the present application, when the host needs to read data from the SSD, it sends a read request through the Flash Translation Layer (FTL). This request is encapsulated into a message (MSG) and placed in a submission queue (SQ).

[0072] The FCC takes the pending read messages from the SQ queue, which is usually based on the FIFO (first in, first out) principle, that is, the first message to arrive is processed first. The FCC parses the information in the read message to determine the physical address of the data that needs to be read from the NAND flash memory.

[0073] Based on the parsed physical address information, the FCC sends a read command to the NAND flash memory to start the read operation. Waiting time for read (tR): After the NAND flash memory receives the read command, it enters the internal operation time (Time for Read, tR), which is the time required to read data from the NAND cell into its internal buffer.

[0074] In an embodiment of the present application, the first message may refer to a message being read, and the first read cycle tR may specifically refer to a period for executing a read instruction of the first message, which is a relatively long time for the CPU. During the waiting period of tR, the flash channel controller may pre-screen the next Read command to be executed when idle.

[0075] In the embodiment of the present application, the first message at the head of the submission queue is first taken out as the message to be executed next, that is, the first header message, recorded as MSG1, MSG1 is removed from SQ and put into the PQnext_rd queue, and MSG1 is used as MSGpre1. At this time, there is only one message MSGpre1 in the PQnext_rd queue.

[0076] Then, all second messages having the same physical page as the first header message are further found in the submission queue at once, and then the found second messages are sequentially migrated to the first cache queue.

[0077] Step 420: When entering a second read cycle for executing a read command of the first header message or any of the second messages, migrate the first header message and the second message cached in the first cache queue to a second cache queue;

[0078] In the embodiment of the present application, in the first read cycle, the FCC has migrated the first header message and the second message pointing to the same physical page to the first cache queue PQnext_rd.

[0079] The second read cycle may be a read cycle for executing the read command of the first header message or any of the second messages, which means that when entering the second read cycle, the FCC checks the messages in the first cache queue PQnext_rd and transfers these messages to the second cache queue PQcur_rd. This step is to prepare for the upcoming Bulk Data Transfer (BDT) operation.

[0080] As messages are transferred from PQcur_rd to PQnext_rd, the state of PQcur_rd is updated accordingly to reflect the messages that have been transferred. This ensures the consistency and accuracy of the queue.

[0081] By transferring the message from PQcur_rd to PQnext_rd, the FCC can ensure that when a read command is executed, all related read requests are ready, thereby reducing the time required to process each individual read request.

[0082] Step 430: After the second reading cycle ends, the messages cached in the second cache queue are transmitted in batches.

[0083] In the embodiment of the present application, after the second read cycle ends, the flash channel controller starts to perform a batch data transfer operation, which means that the flash channel controller reads data corresponding to multiple messages from the NAND Flash and transmits the data to the host.

[0084] The flash channel controller polls the second cache queue PQcur_rd and takes out each message cached in the queue one by one. This process involves checking each element in the queue and processing them in order.

[0085] For each message in PQcur_rd, the flash channel controller performs a data transfer operation. This includes reading data from NAND Flash and sending the data to the host's memory through the data bus.

[0086] After the data transfer is complete, the flash channel controller generates a completion message (CPL) for each transmitted message. These completion messages are placed in the completion queue (CQ) so that the host can know which data is ready to be read.

[0087] In an embodiment of the present application, during the waiting period for the previous message to be read, the flash channel controller can pre-migrate the first header message at the head of the submission queue to the first cache queue for caching the message to be read next time, and search the submission queue for the second message with the same physical page as the first header message, so as to arrange and integrate the messages with the same physical page. When the data is subsequently read, the data is obtained from the first cache queue first. Only one data read is required, which can realize batch data transmission of the data in the first cache queue, reduce the number of operations on the NAND, save a lot of reading waiting time, and effectively improve the efficiency of message reading.

[0088] Optionally, when entering a first read cycle of executing a read command for a first message, migrating a first header message and a second message of a submission queue to a first cache queue includes:

[0089] Migrating the first header message of the submission queue to the first cache queue;

[0090] Comparing the physical page of the first header message with the physical page of each message in the submission queue one by one;

[0091] When a second message having the same physical page as the first header message is detected, the second message is migrated to the first cache queue, and the second message is deleted from the submission queue to obtain an updated submission queue;

[0092] Or, in the event that a third message having a physical page different from that of the first header message is detected, the third message is retained in the submission queue.

[0093] In the embodiment of the present application, when the FCC is ready to execute a read command, it first identifies the first header message in the submission queue SQ, which is usually the earliest read request to enter the queue.

[0094] FCC migrates the first header message to the first cache queue PQnext_rd. This step is to temporarily store the read request to be processed so as to perform subsequent read operations.

[0095] Figure 5 A schematic diagram of placing the header message in the submission queue into the first cache queue provided in an embodiment of the present application, such as Figure 5 As shown, it includes: first taking out the MSG at the head of the SQ, that is, the next MSG to be executed (MSG1 in the SQ), recorded as MSGpre1, removing MSGpre1 from the SQ, and putting it into the PQnext_rd queue. At this time, there is only one message MSGpre1 in the PQnext_rd queue, and there is no MSG1 in the changed SQ queue. At this time, the head message in the changed SQ queue is updated to MSG2.

[0096] Next, the FCC compares the physical page pointed to by the first header message with the physical pages of other messages in the submission queue SQ. This step is to identify all read requests pointing to the same physical page.

[0097] Figure 6 The following is a queue status diagram in an embodiment of the present application. The final status of the messages in the submission queue and the first cache queue after the traversal is completed. All valid messages are taken out in turn in SQ and recorded as MSGn and the physical page to be read by MSGpre1 for judgment. If they are the same physical page, MSGn is removed from SQ and hung in the PQnext_rd queue. Since the reading positions of MSG2 and MSGpre1 are irrelevant, after the comparison of MSG2 is completed, the status of the SQ and PQnext_rd queues does not change. When MSG3 After the comparison, since MSG3 and MSG1 read the same physical page, MSG3 will be removed from the SQ queue and put into the PQnext_rd queue. At this time, PQnext_rd contains two messages, MSGpre1 and MSGpre2, which correspond to MSG1 and MSG3 in the initial SQ queue respectively. Other valid messages in SQ will continue to be compared until all messages are compared. Since only MSG1 and MSG3 have position correlation, the final queue status of SQ and PQnext_rd is as above. Figure 6 shown.

[0098] If FCC detects a second message in SQ that points to the same physical page as the first header message, it will also migrate these second messages to PQcur_rd and delete them from SQ. This step is to optimize read operations by merging read requests pointing to the same physical page and reducing the number of accesses to NAND Flash.

[0099] For the third message pointing to different physical pages, FCC will keep these messages in SQ. These messages will wait for subsequent read cycles to be processed.

[0100] The optimization goal of this process is to reduce the number of read commands to the NAND Flash and improve the reading efficiency by merging read requests, thereby reducing the read latency and increasing the number of read and write (I / O) operations per second.

[0101] In an embodiment of the present application, the flash channel controller performs data screening of the first cache queue, which can effectively manage read requests, optimize the read performance of the SSD, reduce latency, and improve data transmission efficiency.

[0102] Optionally, after the step of migrating the first header message and the second message cached in the first cache queue to the second cache queue, the method further includes:

[0103] Migrate the second header message and the fourth message of the updated submission queue to the first cache queue; wherein the fourth message is a message in the submission queue that has the same physical page as the second header message;

[0104] When entering a third read cycle for executing a read command for the second header message or any of the fourth messages, migrating the second header message and the fourth message cached in the first cache queue to the second cache queue;

[0105] After the third reading cycle ends, the messages cached in the second cache queue are transmitted in batches.

[0106] In the embodiment of the present application, after completing the transmission of the first header message and the second message, the FCC continues to process the next read request in the updated submission queue (SQ), that is, the second header message. At the same time, the FCC will compare and identify the fourth message pointing to the same physical page as the second header message, and migrate these messages to the first cache queue PQnext_rd.

[0107] When the FCC enters the third read cycle, it transmits the second header message and the fourth message buffered in PQcur_rd to the second buffer queue PQcur_rd. This step is to prepare to execute the read commands corresponding to these messages.

[0108] After the third read cycle is completed, FCC will perform Bulk Data Transfer (BDT) on the messages cached in PQnext_rd, which means that FCC will read the data corresponding to these messages from NAND Flash and transfer them to the host.

[0109] In the embodiment of the present application, the overall performance of the SSD is improved by reducing the number of accesses to the NAND Flash, reducing the read latency, and increasing the number of read and write operations per second.

[0110] Optionally, after migrating the first header message of the submission queue to the first cache queue, and comparing the physical page of the first header message with the physical pages of each message in the submission queue one by one, the method further includes:

[0111] If there is no second message in the submission queue that has the same physical page as the first header message, no other messages are migrated to the first cache queue in the first read cycle;

[0112] When entering the second reading cycle, the first header message in the first cache queue is transmitted to the second cache queue, and the first header message is deleted from the first cache queue.

[0113] In an embodiment of the present application, in the first read cycle of the Flash Channel Controller (FCC) executing the read command of the first header message, the FCC will migrate the first header message in the submission queue (SQ) to the first cache queue (PQcur_rd). Then, the FCC will compare the physical page of the first header message with the physical pages of other messages in the SQ one by one to identify all messages pointing to the same physical page, that is, the second message. If there is no second message in the SQ that has the same physical page as the first header message, then during the first read cycle, the FCC will not migrate other messages to PQcur_rd. When entering the second read cycle, the FCC transfers the first header message in PQcur_rd to the second cache queue (PQnext_rd) and deletes the message in PQcur_rd.

[0114] Optionally, after the step of migrating the first header message and the second message of the submitted queue to the first cache queue, the method further includes:

[0115] After the first reading cycle ends, if the first cache queue is not empty, directly obtain the first header message or any of the second messages from the first cache queue;

[0116] Execute a read command of the first header message or any of the second messages to enter a second read cycle.

[0117] In the embodiment of the present application, after the first read cycle ends, if the PQcur_rd queue is not empty, the FCC directly obtains messages from the PQcur_rd queue and executes the read commands of these messages to enter the second read cycle, rather than obtaining messages from the submission queue.

[0118] Compared with obtaining messages from the submission queue, since the messages in the PQcur_rd queue are all for the same physical Page, only one Nand operation (tR) is required to perform multiple batch data transfers (BDT), thereby reducing repeated operations on Nand, saving a lot of tR time, and improving the read operation efficiency of the SSD.

[0119] Optionally, the flash channel controller executes a read command of the first header message or any of the second messages to enter a second read cycle, including:

[0120] Parsing the first header message or any of the second messages to determine a read command of the first header message or any of the second messages;

[0121] The flash channel controller executes a read command of the first header message or any one of the second messages and enters a second read cycle.

[0122] In the embodiment of the present application, the FCC first checks whether the PQnext_rd queue contains messages. If the queue is not empty, it means that there are pre-screened messages for the same physical Page waiting to be processed.

[0123] FCC takes the first message (MSG) from the PQnext_rd queue. Since all messages in the queue are for the same physical page, any message can be taken out for parsing. The purpose of parsing is to determine the specific read command of the message, including the specific location of the data to be read in the NAND Flash.

[0124] After parsing, FCC sends a read command (Nand CMD command) to NAND Flash. This command triggers NAND Flash to enter the internal operation time (tR), which is the time required to read data from the NAND cell into its internal buffer.

[0125] Optionally, after the step of migrating the first header message and the second message of the submission queue to the first cache queue, the flash channel controller further includes:

[0126] After the first read cycle ends, when the first cache queue is empty, the flash channel controller copies the third header message from the submission queue to the second cache queue;

[0127] The third header message is deleted from the submission queue.

[0128] In the embodiment of the present application, when the previous read command is completed and the FW has just sent the next read MSG to the SQ, and the FCC has not had time to filter and sort the commands, the PQnext_rd queue may be empty and the SQ queue may not be empty.

[0129] In the embodiment of the present application, the FCC first checks whether the PQcur_rd queue is empty. If the queue is empty, it means that there is no message that needs to be BDT operated.

[0130] Since the PQcur_rd queue is empty, FCC needs to get a new message from the SQ queue to continue processing. FCC will select the third head message in the SQ queue (that is, the next message to be processed).

[0131] FCC copies the third header message from the SQ queue to the PQnext_rd queue, which is used to prepare the next batch of messages to be processed so that the processing can start immediately after the current reading cycle ends.

[0132] Deleting messages from the SQ queue: After copying the third header message to the PQnext_rd queue, the FCC deletes the message from the SQ queue to avoid repeated processing of the message and keep the SQ queue updated.

[0133] After the next batch of messages is ready in the PQnext_rd queue, the FCC can start the next read cycle. At the beginning of a new read cycle, the FCC will repeat the previous process: check the PQnext_rd queue, perform message parsing, send NAND commands, perform BDT operations, and return a completion message.

[0134] In the embodiment of the present application, the first cache queue helps to improve the IOPS of the SSD because it reduces the waiting time and allows the FCC to process more read requests faster. By optimizing the message processing flow inside the FCC, this method helps to improve the overall performance of the SSD and meet the demand for high-performance storage devices.

[0135] Optionally, after the step of migrating the first header message and the second message of the submission queue to the first cache queue, the flash channel controller further includes:

[0136] After the first read cycle ends, when the first cache queue is empty and the commit queue is also empty, the flash channel controller enters an idle state.

[0137] In the embodiment of the present application, if the PQcur_rd queue is empty, the FCC then checks whether the SQ queue is also empty. The SQ queue is a queue for storing pending read messages. If this queue is also empty, it means that there is no new message that needs to be processed immediately.

[0138] When both queues are empty, the FCC has no more read messages to process, so it enters the idle state. In this state, the FCC can suspend its operation and wait for new messages to arrive.

[0139] Waiting for new messages: In the idle state, the FCC will wait for the firmware to send a new read message to the SQ queue. Once a new message arrives, the FCC will wake up from the idle state and start processing the new message.

[0140] In the embodiment of the present application, it is ensured that the FCC does not waste resources when there is no read message to be processed, and can also quickly respond to new messages to maintain the high efficiency and performance of the SSD. In this way, the FCC can balance performance and power consumption to provide a better user experience.

[0141] Optionally, after the second reading cycle ends, performing batch data transmission on the messages cached in the second cache queue includes:

[0142] Polling the second cache queue, taking out each cached message from the second cache queue one by one, and obtaining the cached messages of the second cache queue;

[0143] Perform a batch data transmission operation on the cached messages of the second cache queue.

[0144] In the embodiment of the present application, the FCC starts polling the PQnext_rd queue, which means that the FCC will process each message in the queue in sequence. The polling process ensures that each message in the queue can be processed in sequence.

[0145] During the polling process, the FCC takes out the cached messages in the PQnext_rd queue one by one. These messages are pre-screened and their corresponding physical page addresses are the same, so they can be merged into one NAND operation. For each message taken out, the FCC performs a bulk data transfer operation. This operation involves transferring data from the internal buffer of the NAND Flash to the external buffer via the NAND bus. Since these messages correspond to the same physical page address, the transfer of all related data can be completed at one time.

[0146] After the BDT operation of each message is completed, the FCC will send a completion message (CPL) to the completion queue. This CPL message notifies the flash translation layer that the corresponding read operation has been completed.

[0147] After processing each message, the FCC deletes the message from the PQnext_rd queue to update the queue status. This ensures that only messages that have not been processed are kept in the queue. Repeat until the queue is empty: The FCC continues to poll and process messages in the PQnext_rd queue until the queue is empty. This indicates that all messages filtered out in the second read cycle have been processed.

[0148] In the embodiment of the present application, the FCC can efficiently process read requests with the same physical page address, reduce repeated read operations on the NAND Flash, save a lot of read time, and thus improve the read operation efficiency of the SSD.

[0149] Figure 7 A schematic diagram of message transmission provided in an embodiment of the present application, such as Figure 7 As shown, FCC starts to take the next message to be read, and first determines whether the PQnext_rd queue is empty;

[0150] If the PQnext_rd queue is not empty, messages will no longer be taken from SQ, but from the PQnext_rd queue; any MSG in the PQnext_rd queue is taken out (any one can be taken, because all MSGs in the PQnext_rd queue are read from the same physical page) for parsing, and then the Nand CMD command is sent. At this time, Nand enters the internal operation time (tR); all messages in the PQnext_rd queue are copied to the PQcur_rd queue, and the PQnext_rd queue is cleared for the next message pre-screening.

[0151] Figure 8 A schematic diagram of batch transmission provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, after tR of the read command is completed, the PQcur_rd queue is polled, and each MSG is taken out one by one until the PQcur_rd queue is empty, and a batch data transmission operation is performed. After completion, a completion message is returned to the firmware to the completion queue, and the MSG is deleted from the PQcur_rd queue.

[0152] In an embodiment of the present application, by adding a retrieval judgment process, the read MSGs with relevant read positions are unified and merged and placed in the same cache queue, that is, these messages are read only once, and after the reading period is over, batch data transmission is performed separately, and completion messages are returned to the completion queue respectively. The reply completion message part is consistent with the previous one, that is, the FTL does not perceive this process.

[0153] The message reading device provided by the present invention is described below. The message reading device described below and the message reading method described above can be referred to each other.

[0154] Fig. 9 A schematic diagram of the structure of a message reading device provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, including:

[0155] The first migration module 910 is used to migrate the first header message and the second message of the submission queue to the first cache queue when entering the first read cycle of executing the read command of the first message; wherein the second message is a message in the submission queue with the same physical page as the first header message;

[0156] The second migration module 920 is used to migrate the first header message and the second message cached in the first cache queue to the second cache queue when entering the second read cycle of executing the read command of the first header message or any of the second messages;

[0157] The transmission module 930 is used for transmitting the messages cached in the second cache queue in batches after the second reading cycle ends.

[0158] Optionally, the device is also used for:

[0159] Migrating the first header message of the submission queue to the first cache queue;

[0160] Comparing the physical page of the first header message with the physical page of each message in the submission queue one by one;

[0161] When a second message having the same physical page as the first header message is detected, the second message is migrated to the first cache queue, and the second message is deleted from the submission queue to obtain an updated submission queue;

[0162] Or, in the event that a third message having a physical page different from that of the first header message is detected, the third message is retained in the submission queue.

[0163] Optionally, the device is also used for:

[0164] A first migration module is used to migrate a first header message and a second message of a submission queue to a first cache queue when entering a first read cycle of executing a read command of a first message; wherein the second message is a message in the submission queue having the same physical page as the first header message;

[0165] A second migration module is used to migrate the first header message and the second message cached in the first cache queue to the second cache queue when entering a second read cycle of executing a read command of the first header message or any of the second messages;

[0166] The transmission module is used for transmitting the messages cached in the second cache queue in batches after the second reading cycle ends.

[0167] Optionally, the device is also used for:

[0168] If there is no second message in the submission queue that has the same physical page as the first header message, no other messages are migrated to the first cache queue in the first read cycle;

[0169] When entering the second reading cycle, the first header message in the first cache queue is migrated to the second cache queue, and the first header message is deleted from the first cache queue.

[0170] Optionally, the device is also used for:

[0171] Parsing the first header message or any of the second messages to determine a read command of the first header message or any of the second messages;

[0172] The flash channel controller executes a read command of the first header message or any one of the second messages and enters a second read cycle.

[0173] Optionally, the device is also used for:

[0174] Determine, according to the physical page of the first header message or any one of the second messages, a physical storage location corresponding to the physical page;

[0175] The read command is determined according to a physical storage location corresponding to the physical page.

[0176] Optionally, the device is also used for:

[0177] After the first read cycle ends, when the first cache queue is empty, the flash channel controller copies the third header message from the submission queue to the second cache queue;

[0178] The third header message is deleted from the submission queue.

[0179] Optionally, the device is also used for:

[0180] After the first read cycle ends, when the first cache queue is empty and the commit queue is also empty, the flash channel controller enters an idle state.

[0181] Optionally, the device is also used for:

[0182] Polling the second cache queue, taking out each cached message from the second cache queue one by one, and obtaining the cached messages of the second cache queue;

[0183] Perform a batch data transmission operation on the cached messages of the second cache queue.

[0184] Optionally, the device is also used for:

[0185] When the cached message in the second cache queue completes the batch data transmission operation, the completion message corresponding to the cached message in the second cache queue is migrated to the completion queue, and the cached message is deleted from the second cache queue.

[0186] In an embodiment of the present application, during the waiting period for the previous message to be read, the flash channel controller can pre-migrate the first header message at the head of the submission queue to the first cache queue for caching the message to be read next time, and search the submission queue for the second message with the same physical page as the first header message, so as to arrange and integrate the messages with the same physical page. When the data is subsequently read, the data is obtained from the first cache queue first. Only one data read is required, which can realize batch data transmission of the data in the first cache queue, reduce the number of operations on the NAND, save a lot of reading waiting time, and effectively improve the efficiency of message reading.

[0187] Fig.10 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Fig.10As shown, the electronic device may include: a processor 1010, a communication interface 1020, a memory 1030 and a communication bus 1040, wherein the processor 1010, the communication interface 1020 and the memory 1030 communicate with each other through the communication bus 1040. The processor 1010 may call the logic instructions in the memory 1030 to execute the message reading method, the method comprising: in the case of entering the first reading cycle of executing the read command of the first message, migrating the first header message and the second message of the submission queue to the first cache queue; wherein the second message is a message in the submission queue with the same physical page as the first header message;

[0188] When entering a second read cycle for executing a read command for the first header message or any of the second messages, migrating the first header message and the second message cached in the first cache queue to a second cache queue;

[0189] After the second reading cycle ends, the messages cached in the second cache queue are transmitted in batches.

[0190] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0191] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the message reading method provided by the above methods, the method comprising: in the case of entering a first read cycle of executing a read command of a first message, migrating a first header message and a second message of a submission queue to a first cache queue; wherein the second message is a message in the submission queue having the same physical page as the first header message;

[0192] When entering a second read cycle for executing a read command for the first header message or any of the second messages, migrating the first header message and the second message cached in the first cache queue to a second cache queue;

[0193] After the second reading cycle ends, the messages cached in the second cache queue are transmitted in batches.

[0194] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the message reading method provided by the above methods, the method comprising: in the case of entering a first read cycle of executing a read command of a first message, migrating a first header message and a second message of a submission queue to a first cache queue; wherein the second message is a message in the submission queue having the same physical page as the first header message;

[0195] When entering a second read cycle for executing a read command for the first header message or any of the second messages, migrating the first header message and the second message cached in the first cache queue to a second cache queue;

[0196] After the second reading cycle ends, the messages cached in the second cache queue are transmitted in batches.

[0197] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0198] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0199] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A message reading method, characterized in that: Applied to a flash channel controller, the method comprises: In the case of entering a first read cycle of executing a read command of a first message, migrating a first header message and a second message of a submission queue to a first cache queue; wherein the second message is a message in the submission queue having the same physical page as the first header message; When entering a second read cycle for executing a read command for the first header message or any of the second messages, migrating the first header message and the second message cached in the first cache queue to a second cache queue; After the second reading cycle ends, the messages cached in the second cache queue are transmitted in batches; Wherein, when entering the first reading cycle of executing the reading command of the first message, migrating the first header message and the second message of the submission queue to the first cache queue includes: Migrating the first header message of the submission queue to the first cache queue; Comparing the physical page of the first header message with the physical page of each message in the submission queue one by one; When a second message having the same physical page as the first header message is detected, the second message is migrated to the first cache queue, and the second message is deleted from the submission queue to obtain an updated submission queue; Or, in the event that a third message having a physical page different from that of the first header message is detected, the third message is retained in the submission queue.

2. The message reading method according to claim 1, characterized in that: After the step of migrating the first header message and the second message cached in the first cache queue to the second cache queue, the method further includes: Migrate the second header message and the fourth message of the updated submission queue to the first cache queue; wherein the fourth message is a message in the submission queue that has the same physical page as the second header message; When entering a third read cycle for executing a read command for the second header message or any of the fourth messages, migrating the second header message and the fourth message cached in the first cache queue to the second cache queue; After the third reading cycle ends, the messages cached in the second cache queue are transmitted in batches.

3. The message reading method according to claim 1, characterized in that: After migrating the first header message of the submission queue to the first cache queue, and comparing the physical page of the first header message with the physical pages of each message in the submission queue one by one, the method further includes: If there is no second message in the submission queue that has the same physical page as the first header message, no other messages are migrated to the first cache queue in the first read cycle; When entering the second reading cycle, the first header message in the first cache queue is migrated to the second cache queue, and the first header message is deleted from the first cache queue.

4. The message reading method according to claim 1, characterized in that: After the step of migrating the first header message and the second message of the submitted queue to the first cache queue, the method further includes: After the first reading cycle ends, if the first cache queue is not empty, directly obtain the first header message or any of the second messages from the first cache queue; Execute a read command of the first header message or any of the second messages to enter a second read cycle.

5. The message reading method according to claim 4, characterized in that: Executing a read command of the first header message or any of the second messages to enter a second read cycle includes: Parsing the first header message or any of the second messages to determine a read command of the first header message or any of the second messages; Send a read command for the first header message or any one of the second messages to enter a second read cycle.

6. The message reading method according to claim 5, characterized in that: Parsing the first header message or any of the second messages to determine a read command of the first header message or any of the second messages includes: Determine, according to a physical page of the first header message or any one of the second messages, a physical storage location corresponding to the physical page; The read command is determined according to a physical storage location corresponding to the physical page.

7. The message reading method according to claim 1, characterized in that: After the step of migrating the first header message and the second message of the submitted queue to the first cache queue, the method further includes: After the first read cycle ends, if the first cache queue is empty, copy the third header message from the submission queue to the second cache queue; The third header message is deleted from the submission queue.

8. The message reading method according to claim 7, characterized in that: After the step of migrating the first header message and the second message of the submitted queue to the first cache queue, the method further includes: After the first read cycle ends, when the first cache queue is empty and the submission queue is also empty, an idle state is entered.

9. The message reading method according to claim 1, characterized in that: After the second reading cycle ends, the messages cached in the second cache queue are transmitted in batches, including: Polling the second cache queue, taking out each cached message from the second cache queue one by one, and obtaining the cached messages of the second cache queue; Perform a batch data transmission operation on the cached messages of the second cache queue.

10. The message reading method according to claim 9, characterized in that: After the step of performing a batch data transmission operation on the cached messages in the second cache queue, the method further includes: When the cached message in the second cache queue completes the batch data transmission operation, the completion message corresponding to the cached message in the second cache queue is migrated to the completion queue, and the cached message is deleted from the second cache queue.

11. The message reading method according to claim 1, characterized in that: The first cache queue is used to cache messages to be read next time, and the second cache queue is used to cache messages currently being read.

12. A message reading device, characterized in that: include: A first migration module is used to migrate a first header message and a second message of a submission queue to a first cache queue when entering a first read cycle of executing a read command of a first message; wherein the second message is a message in the submission queue having the same physical page as the first header message; A second migration module is used to migrate the first header message and the second message cached in the first cache queue to the second cache queue when entering a second read cycle of executing a read command of the first header message or any of the second messages; A transmission module, configured to transmit the messages cached in the second cache queue in batches after the second reading cycle ends; Wherein, the device is also used for: Migrating the first header message of the submission queue to the first cache queue; Comparing the physical page of the first header message with the physical page of each message in the submission queue one by one; When a second message having the same physical page as the first header message is detected, the second message is migrated to the first cache queue, and the second message is deleted from the submission queue to obtain an updated submission queue; Or, in the event that a third message having a physical page different from that of the first header message is detected, the third message is retained in the submission queue.

13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the message reading method according to any one of claims 1 to 11 is implemented.

14. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the message reading method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Media interface controller and storage controller for read command fusion

    CN113434082A

  • Method for realizing pre-reading of DRAM Less storage device

    CN118585466A