Data reading and writing method, device, solid-state drive, electronic device and storage medium
By dividing the data read and write commands of the solid-state drive into subcommand groups and determining priority based on the execution time, the problem of low read and write performance of the solid-state drive is solved, and higher read and write rates and performance are achieved.
Patent Information
- Application Number
- CN202310146366.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-21
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2043-02-21
AI Technical Summary
The read and write performance of existing solid-state drives is poor and cannot be effectively improved.
By obtaining data read and write commands, dividing them into subcommand groups, and prioritizing them based on the execution time of the subcommand group, priority is given to the execution time of the subcommand group, and subcommand groups with shorter execution time is reduced.
It improves the read and write rate of solid-state hard disk, reduces read and write time, and improves read and write performance.
Smart Images

Figure CN116301604B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of servers, and more particularly, to a data reading and writing method, apparatus, solid state drive, electronic device, and storage medium. Background Art
[0002] With the development and wide application of technologies such as the Internet, cloud computing, and the Internet of Things, in human life, a large amount of data needs to be processed and stored at all times. The rapid development of information technology has put forward higher requirements for the performance of storage systems. Solid State Drives (SSDs) are widely adopted because of their fast read and write speeds and low energy consumption. Solid state hard drives generally execute strictly in the order of read and write commands issued by the host, and the total time consumed for read and write operations is relatively large, and the data read and write performance is poor.
[0003] Therefore, how to improve the read and write performance of solid state drives has become a technical problem that needs to be solved urgently in the industry. Summary of the Invention
[0004] The present application provides a data reading and writing method, apparatus, solid state drive, electronic device, and storage medium, which are used to solve the technical problem of how to improve the read and write performance of solid state drives.
[0005] The present application provides a data reading and writing method, including:
[0006] Obtaining a plurality of data read and write commands corresponding to a current channel;
[0007] Based on a plurality of sub-commands corresponding to each data read and write command and the execution association relationship between the plurality of sub-commands, determining a plurality of sub-command groups corresponding to each data read and write command;
[0008] Based on the execution duration of each sub-command group corresponding to each data read and write command, determining the execution priority of each sub-command group corresponding to each data read and write command;
[0009] Based on the execution priority of each sub-command group corresponding to each data read and write command, determining the execution result of each data read and write command in the current channel.
[0010] According to the data reading and writing method provided by the present application, the determining the execution priority of each sub-command group corresponding to each data read and write command based on the execution duration of each sub-command group corresponding to each data read and write command includes:
[0011] Based on the execution duration of each sub-command in any sub-command group corresponding to any data read and write command, determining the execution duration of the any sub-command group corresponding to the any data read and write command;
[0012] In the case that the execution duration of any one of the sub - command groups is less than a preset execution duration, divide each sub - command in the any one of the sub - command groups into a first command queue;
[0013] In the case that the execution duration of any one of the sub - command groups is greater than or equal to the preset execution duration, divide each sub - command in the any one of the sub - command groups into a second command queue;
[0014] Wherein, the execution priority of the first command queue is higher than that of the second command queue.
[0015] According to the data reading and writing method provided by the present application, the dividing each sub - command in the any one of the sub - command groups into the second command queue includes:
[0016] Add an execution mark for each sub - command in the any one of the sub - command groups in the second command queue;
[0017] Wherein, the execution marks of each sub - command in the same sub - command group are the same; the execution marks of each sub - command in different sub - command groups are different.
[0018] According to the data reading and writing method provided by the present application, the determining the execution result of each data reading and writing command in the current channel based on the execution priorities of each sub - command group corresponding to each data reading and writing command includes:
[0019] Based on the first command queue and the second command queue, determine the current sub - command;
[0020] In the case that the current sub - command includes an execution mark, based on the execution mark, determine the associated sub - command corresponding to the current sub - command in the second command queue; the associated sub - command and the current sub - command belong to the same sub - command group;
[0021] Based on the execution result of the current sub - command and the execution result of the associated sub - command, determine the execution result of the sub - command group corresponding to the current sub - command;
[0022] Based on the execution results of each sub - command group corresponding to each data reading and writing command, determine the execution results of each data reading and writing command.
[0023] According to the data reading and writing method provided by the present application, the determining each sub - command group corresponding to each data reading and writing command based on the multiple sub - commands corresponding to each data reading and writing command and the execution association relationship between the multiple sub - commands includes:
[0024] Parse any one data reading and writing command to determine the multiple sub - commands corresponding to the any one data reading and writing command, as well as the command words and storage addresses of each sub - command;
[0025] Determine the execution association relationship between each sub-command based on the command word and storage address of each sub-command;
[0026] Based on the execution association relationship between each sub-command, group the multiple sub-commands corresponding to any one of the data read / write commands to obtain multiple sub-command groups corresponding to any one of the data read / write commands.
[0027] According to the data read / write method provided by the present application, the multiple sub-commands corresponding to the data read / write command are determined based on the execution stage of the data read / write command in the solid-state drive.
[0028] The present application provides a data read / write method, including:
[0029] An acquisition unit, configured to acquire multiple data read / write commands corresponding to the current channel;
[0030] A command group determination unit, configured to determine multiple sub-command groups corresponding to each data read / write command based on the multiple sub-commands corresponding to each data read / write command and the execution association relationship between the multiple sub-commands;
[0031] A priority determination unit, configured to determine the execution priority of each sub-command group corresponding to each data read / write command based on the execution duration of each sub-command group corresponding to each data read / write command;
[0032] An execution unit, configured to determine the execution result of each data read / write command in the current channel based on the execution priority of each sub-command group corresponding to each data read / write command.
[0033] The present application provides a solid-state drive, including a control chip;
[0034] The data read / write device is provided in the control chip.
[0035] The present application provides a computer-readable storage medium, where the computer-readable storage medium includes a stored program, and when the program runs, it executes the data read / write method.
[0036] The present application provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to execute the data read / write method through the computer program.
[0037] The data reading and writing method, device, solid-state drive, electronic device, and storage medium provided by this application obtain multiple data reading and writing commands corresponding to the current channel; determine multiple sub-command groups corresponding to each data reading and writing command according to multiple sub-commands corresponding to each data reading and writing command and the execution association relationship between the multiple sub-commands; determine the execution priorities of the multiple sub-command groups corresponding to each data reading and writing command according to the execution durations of the respective sub-command groups corresponding to each data reading and writing command; determine the execution results of each data reading and writing command in the current channel according to the execution priorities of the respective sub-command groups corresponding to each data reading and writing command; by dividing the data reading and writing commands sent by the host device into sub-command groups and determining different execution priorities for each sub-command group, the sub-command groups with higher priorities are preferentially executed, and there is no need to strictly execute according to the order of the commands issued by the host device, which can reduce the waiting time for the execution of commands in each logical unit of the flash chip of the solid-state drive, thereby improving the reading and writing speed of the solid-state drive, reducing the reading and writing time of the solid-state drive, and enhancing the reading and writing performance of the solid-state drive. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings herein are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application and, together with the specification, are used to explain the principles of the present application.
[0039] To more clearly illustrate the technical solutions in the present application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0040] Figure 1 is one of the flow diagrams of the data reading and writing method provided by the present application;
[0041] Figure 2 is the second flow diagram of the data reading and writing method provided by the present application;
[0042] Figure 3 is the structural diagram of the data reading and writing device provided by the present application;
[0043] Figure 4 is the structural diagram of the solid-state drive provided by the present application;
[0044] Figure 5 is the structural diagram of the electronic device provided by the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0045] To enable those skilled in the art to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.
[0046] It should be noted that the terms "first", "second", etc. in this application are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0047] Figure 1 is one of the flow diagrams of the data reading and writing method provided by this application. As Figure 1 shown, the method includes step 110, step 120, step 130, and step 140.
[0048] Step 110: Obtain multiple data reading and writing commands corresponding to the current channel.
[0049] Specifically, the execution subject of the data reading and writing method provided in the embodiments of this application can be a data reading and writing device. The data reading and writing device can be a control chip in a solid-state drive, or a component of the control chip, or can be embodied in software, such as a control program running in the control chip of the solid-state drive.
[0050] A solid-state drive generally includes a control chip, a cache chip, and a flash chip. The control chip is responsible for the connection between the flash chip and the external data interface, and controls the data reading and writing of each flash chip. The cache chip is used to quickly receive external data. The flash chip is used to store external data for a long time. For example, when external data is written, the external data is first stored in the cache chip and then written into the flash chip.
[0051] Internally, solid-state drives adopt a parallel mechanism. A solid-state drive generally consists of multiple independent channels, each independent channel is connected to multiple independent flash chips, and each flash chip includes multiple logical units (Logical Unit, LUN). Each logical unit is the smallest unit that directly executes data read and write commands. In the embodiments of the present application, the data read and write method is executed within each channel.
[0052] The current channel is the channel in the solid-state hardware where data is about to be written or read. The host device here can be a server or a personal computer, etc. The data read and write commands are issued by the central processing unit of the host device and are used to control the writing or reading of data to / from the solid-state drive. Generally, the data read and write commands issued by the host device have a time sequence. The solid-state drives in the prior art also strictly execute in the order of the commands issued by the host device.
[0053] Step 120: Based on the multiple sub-commands corresponding to each data read and write command and the execution association relationship between the multiple sub-commands, determine the multiple sub-command groups corresponding to each data read and write command.
[0054] Specifically, for each data read and write command, it can be divided into multiple sub-commands according to the execution stage of the data read and write command in the solid-state drive. For example, the host device issues a data read command to the solid-state drive. When this command is executed in the solid-state drive, it can include 3 sub-commands, namely reading the data in the flash chip to the cache chip, transmitting the data in the cache chip to the host device, and detecting the read status of the flash chip.
[0055] The execution association relationship refers to the association relationship in the execution order of sub-commands, which can include concurrent execution or sequential execution, etc. For example, for reading the data in the flash chip to the cache chip and detecting the read status of the flash chip, the latter sub-command is used to detect the status of the flash chip to ensure that the former sub-command can be executed completely. These two sub-commands should be executed sequentially in time order, and no other commands or sub-commands can be used between the two sub-commands, so as to ensure the integrity and security of the internal operation of the solid-state drive on the flash chip.
[0056] The sub-command group is composed of sub-commands with an execution association relationship. The multiple sub-commands corresponding to each data read and write command can be grouped according to the execution association relationship to obtain multiple sub-command groups. For example, when grouping the data read command, the first sub-command group and the second sub-command group can be obtained. The first sub-command group includes reading the data in the flash chip to the cache chip and detecting the read status of the flash chip. The second sub-command group includes transmitting the data in the cache chip to the host device.
[0057] Step 130: Determine the execution priorities of each sub - command group corresponding to each data read - write command based on the execution durations of each sub - command group corresponding to each data read - write command.
[0058] Specifically, the execution times of each sub - command group corresponding to each data read - write command can be calculated to obtain the execution durations of each sub - command group. Based on the execution durations of each sub - command group, the execution priorities of each sub - command group are determined.
[0059] The execution priority is to divide the priority order of execution into levels. The higher the execution priority, the more the command should be preferentially allocated computing resources and preferentially executed.
[0060] In a solid - state drive, the sub - command group with a shorter execution duration should be determined to have a higher execution priority. This is because the sub - command group with a shorter execution duration generally requires less computing resources of the control chip in the solid - state drive. After execution, it can quickly release the computing resources for executing other sub - commands or commands, which can reduce the waiting time for each logical unit command execution in the flash memory chip of the solid - state drive, thereby improving the overall read - write speed of the solid - state drive and reducing the overall read - write time of the solid - state drive.
[0061] For example, the first sub - command group includes reading data from the flash memory chip to the cache chip and detecting the read status of the flash memory chip, mainly operating on the flash memory chip, and has a shorter execution duration. The second sub - command group includes transferring data from the cache chip to the host device, mainly operating on the cache chip, and may need to wait for the host device to respond, so it has a longer execution duration. Therefore, the execution priority of the first sub - command group can be set to high, and the execution priority of the second sub - command group can be set to low. The control chip in the solid - state drive preferentially executes the first sub - command group without having to wait for the second sub - command group to complete before executing other commands, and the second sub - command group can be placed for subsequent execution. Between the first sub - command group and the second sub - command group, other sub - command groups with higher execution priorities can be executed, thereby reducing the waiting time of the control chip and improving the overall read - write speed of the solid - state drive.
[0062] Step 140: Determine the execution results of each data read - write command in the current channel based on the execution priorities of each sub - command group corresponding to each data read - write command.
[0063] Specifically, for each data read - write command, it is split into multiple sub - command groups. The execution priorities of each sub - command group are different. For the control chip of the solid - state drive, it can execute each sub - command group corresponding to each data read - write command according to the execution priority to obtain the execution results of each sub - command group.
[0064] For any data read / write command, after each corresponding sub-command group has been executed, the execution result of the data read / write command can be obtained based on the execution results of each sub-command group. For example, for a data read command, after the first sub-command group has been executed, it can be determined that the execution result is that the data has been read from the flash chip into the cache chip; after the second sub-command group has been executed, it can be determined that the execution result is that the data has been transferred from the cache chip to the host device. Then the execution result of the data read command is that the data has been read from the solid-state drive into the host device.
[0065] The data read / write method provided by the embodiments of the present application obtains multiple data read / write commands corresponding to the current channel; determines multiple sub-command groups corresponding to each data read / write command according to multiple sub-commands corresponding to each data read / write command and the execution association relationship between the multiple sub-commands; determines the execution priority of each sub-command group corresponding to each data read / write command according to the execution duration of each sub-command group corresponding to each data read / write command; determines the execution results of each data read / write command in the current channel according to the execution priorities of each sub-command group corresponding to each data read / write command; by dividing the data read / write commands sent by the host device into sub-command groups and determining different execution priorities for each sub-command group, the sub-command group with a higher priority is preferentially executed, and it is not necessary to strictly execute in the order of the commands issued by the host device, which can reduce the waiting time for the execution of each logical unit command in the flash chip of the solid-state drive, thereby improving the read / write speed of the solid-state drive, reducing the read / write time of the solid-state drive, and enhancing the read / write performance of the solid-state drive.
[0066] It should be noted that each embodiment of the present application can be freely combined, the order can be swapped, or it can be executed independently, and it does not need to rely on or depend on a fixed execution order.
[0067] In some embodiments, step 130 includes:
[0068] Based on the execution duration of each sub-command in any sub-command group corresponding to any data read / write command, determine the execution duration of the sub-command group corresponding to the data read / write command;
[0069] In the case where the execution duration of the sub-command group is less than the preset execution duration, divide each sub-command in the sub-command group into the first command queue;
[0070] In the case where the execution duration of the sub-command group is greater than or equal to the preset execution duration, divide each sub-command in the sub-command group into the second command queue;
[0071] Among them, the execution priority of the first command queue is higher than that of the second command queue.
[0072] Specifically, the data reading and writing device in the control chip can create a first command queue and a second command queue in the current channel, and set the execution priority of the first command queue to be higher than that of the second command queue.
[0073] Any data reading and writing command can be divided into multiple sub-command groups. By summing the execution durations of each sub-command in any one of the sub-command groups, the execution duration of the sub-command group can be determined.
[0074] When the execution duration of the sub-command group is less than the preset execution duration, each sub-command in the sub-command group is divided into the first command queue; when the execution duration of the sub-command group is greater than or equal to the preset execution duration, each sub-command in the sub-command group is divided into the second command queue.
[0075] The preset execution duration can be set as needed. For example, the preset execution duration can be the average of the execution durations of different types of sub-commands.
[0076] In some embodiments, dividing each sub-command in any one sub-command group into the second command queue includes:
[0077] Adding an execution mark to each sub-command in any one sub-command group in the second command queue;
[0078] Among them, the execution marks of each sub-command in the same sub-command group are the same; the execution marks of each sub-command in different sub-command groups are different.
[0079] Specifically, for each sub-command in the second command queue, since some sub-commands belong to the same sub-command group, they should be executed together, that is, executed in sequence one after another and no other commands or sub-commands can be executed in the middle. Therefore, execution marks can be added to these sub-commands.
[0080] For each sub-command in the same sub-command group, the same execution mark should be set; for sub-commands belonging to different sub-command groups, different execution marks should be set. The execution mark can be used to distinguish the group relationship of each sub-command in the second command queue, so as to ensure that sub-commands belonging to the same sub-command group are executed together.
[0081] In some embodiments, determining the execution result of each data reading and writing command in the current channel based on the execution priorities of each sub-command group corresponding to each data reading and writing command includes:
[0082] Determining the current sub-command based on the first command queue and the second command queue;
[0083] When the current sub-command contains an execution flag, based on the execution flag, determine the associated sub-command corresponding to the current sub-command in the second command queue; the associated sub-command and the current sub-command belong to the same sub-command group;
[0084] Based on the execution result of the current sub-command and the execution result of the associated sub-command, determine the execution result of the sub-command group corresponding to the current sub-command;
[0085] Based on the execution results of the respective sub-command groups corresponding to the respective data read / write commands, determine the execution results of the respective data read / write commands.
[0086] Specifically, when the control chip executes commands in the current channel, it executes them according to sub-commands. The current sub-command can be obtained from the first command queue and the second command queue. Since the execution priority of the first command queue is higher than that of the second command queue, the control chip preferentially obtains the current sub-command from the first command queue.
[0087] If the current sub-command comes from the first command queue, after executing the current sub-command, continue to obtain the next sub-command from the first command queue. If the first command queue is empty at this time, it indicates that there is temporarily no next sub-command in this queue, and the control chip obtains the current sub-command from the second command queue.
[0088] When the current sub-command contains an execution flag, the associated sub-command corresponding to the current sub-command can be determined in the second command queue according to the execution flag of the current sub-command. The associated sub-command is a sub-command belonging to the same sub-command group as the current sub-command. Obviously, the associated sub-command and the current sub-command have the same execution flag.
[0089] After the control chip executes the current sub-command, it immediately continues to execute the associated sub-command corresponding to the current sub-command. After executing the sub-commands, the execution result of the current sub-command and the execution result of the associated sub-command can be obtained, and then the execution result of the sub-command group corresponding to the current sub-command can be determined.
[0090] For any data read / write command, after the respective sub-command groups corresponding to it are all executed, the execution results of the respective sub-command groups can be obtained, and then the execution result of this data read / write command can be determined.
[0091] In some embodiments, step 120 includes:
[0092] Parse any data read / write command to determine the multiple sub-commands corresponding to this data read / write command, as well as the command words and storage addresses of each sub-command;
[0093] Based on the command words and storage addresses of each sub-command, determine the execution association relationship between each sub-command;
[0094] Group multiple sub-commands corresponding to the data read / write command based on the execution association relationship between each sub-command, to obtain multiple sub-command groups corresponding to the data read / write command.
[0095] Specifically, the control chip of the solid-state drive parses the data read / write command sent by the host device, and can determine multiple sub-commands corresponding to the data read / write command, as well as the command words and storage addresses of each sub-command. The command word is the character corresponding to the data read / write command. The storage address is the number of the storage unit corresponding to the data in the solid-state drive.
[0096] Based on the command words and storage addresses of each sub-command, the execution association relationship between each sub-command can be determined. For example, based on the command word, the command type of the data read / write command or whether multiple data read / write commands can be executed concurrently can be determined, so as to determine the execution association relationship between each sub-command. Another example is that if the storage addresses corresponding to two sub-commands are different, these two sub-commands can be executed concurrently.
[0097] Group multiple sub-commands corresponding to the data read / write command based on the execution association relationship between each sub-command, to obtain multiple sub-command groups corresponding to the data read / write command.
[0098] In some embodiments, multiple sub-commands corresponding to the data read / write command are determined based on the execution stage of the data read / write command in the solid-state drive.
[0099] Specifically, the data read / write command sent by the host device may include a data read command, a data write command, and a status detection command.
[0100] Since the solid-state drive includes a flash memory chip and a cache chip, the execution stage of each data read / write command may include a flash processing stage and a cache processing stage. Correspondingly, the data read command can be divided into a flash read sub-command and a read data transfer sub-command; the sub-commands corresponding to the data write command can be divided into a flash write sub-command and a write data transfer sub-command.
[0101] In addition, the status detection command can be divided into a flash read status detection sub-command and a flash write status detection sub-command.
[0102] Figure 2 is the second flow diagram of the data read / write method provided by the present application, as Figure 2 shown, the method includes:
[0103] Step 210, classify the sub-commands corresponding to the data read / write command
[0104] The read / write transfer commands, operation on non-array (NAND array) commands, and status detection commands are subdivided and recorded as read NAND data sub-command (opR), read NAND status detection sub-command (checkR), read transfer sub-command (xferR), as well as write transfer sub-command (xferW), write NAND sub-command (opW), and write NAND status detection sub-command (checkW). Among them, the status detection sub-command can promptly detect whether the current operation is completed. These sub-commands are divided into two categories:
[0105] The first category: those with short time consumption or triggering concurrent operations (only read and write of host devices), specifically including opR, checkR, and checkW, etc.; the second category: those with relatively long time consumption, specifically including other command types except the first category.
[0106] Step 220: Add the sub-commands to two command queues with different priorities
[0107] Set two command queues (first-in, first-out queues, FIFO) for each channel, namely the high-priority queue and the low-priority queue, and divide the sub-commands into the queues.
[0108] When it is judged that the sub-commands of the first category for the read and write of the host device are to be sent, they are put into the high-priority queue; otherwise, they are put into the low-priority queue.
[0109] Step 230: Mark the same group of commands in the low-priority queue
[0110] Considering that each group of commands contains multiple command words and address types, it is also necessary to ensure the atomicity of data read and write operations. That is, in the low-priority queue, add a flag bit to indicate that this group of commands must be executed together; if the first command of the current group is taken out, this flag is set to 1; when a group of commands is just taken out completely, this flag is set to 0.
[0111] Step 240: Poll the two command queues and execute the sub-commands
[0112] When each channel polls and schedules the executable command queue, judge whether there are sub-commands to be executed in the high-priority queue:
[0113] If not, then continue to detect the low-priority command queue; if there are, then detect whether the flag in the low-priority queue is 1, that is, whether there is a situation where a group of commands has not been taken out completely;
[0114] If there are, then continue to take out commands from the low-priority queue and execute them; if not, then directly take out commands from the high-priority queue and execute them.
[0115] An embodiment of the present application proposes a method for optimizing the performance in a read-write hybrid scenario in a solid-state drive. That is, considering that the processing times of different processing stages of read-write commands are different, by adjusting the way of preferentially executing commands that can achieve fast response, the average waiting time of commands is reduced, thereby improving the overall performance.
[0116] The device provided by the embodiment of the present application will be described below. The device described below can be correspondingly referred to the method described above.
[0117] Figure 3 It is a schematic structural diagram of the data read-write device provided by the present application, as Figure 3 shown. The device includes:
[0118] An acquisition unit 310, configured to acquire a plurality of data read-write commands corresponding to the current channel;
[0119] A command group determination unit 320, configured to determine a plurality of sub-command groups corresponding to each data read-write command based on a plurality of sub-commands corresponding to each data read-write command and the execution association relationship between the plurality of sub-commands;
[0120] A priority determination unit 330, configured to determine the execution priority of each sub-command group corresponding to each data read-write command based on the execution duration of each sub-command group corresponding to each data read-write command;
[0121] An execution unit 340, configured to determine the execution result of each data read-write command in the current channel based on the execution priority of each sub-command group corresponding to each data read-write command.
[0122] The data read-write device provided by the embodiment of the present application acquires a plurality of data read-write commands corresponding to the current channel; determines a plurality of sub-command groups corresponding to each data read-write command according to a plurality of sub-commands corresponding to each data read-write command and the execution association relationship between the plurality of sub-commands; determines the execution priority of each sub-command group corresponding to each data read-write command according to the execution duration of each sub-command group corresponding to each data read-write command; determines the execution result of each data read-write command in the current channel according to the execution priority of each sub-command group corresponding to each data read-write command; by dividing the data read-write commands sent by the host device into sub-command groups and determining different execution priorities for each sub-command group, the sub-command groups with higher priorities are preferentially executed, and it is not necessary to strictly execute according to the order of commands issued by the host device, which can reduce the waiting time for each logical unit command execution in the flash chip of the solid-state drive, thereby improving the read-write rate of the solid-state drive, reducing the read-write time of the solid-state drive, and improving the read-write performance of the solid-state drive.
[0123] In some embodiments, the priority determination unit is specifically configured to:
[0124] Determine the execution duration of any sub - command group corresponding to any data read - write command based on the execution durations of each sub - command in the any sub - command group corresponding to the any data read - write command;
[0125] When the execution duration of any sub - command group is less than the preset execution duration, divide each sub - command in the any sub - command group into the first command queue;
[0126] When the execution duration of any sub - command group is greater than or equal to the preset execution duration, divide each sub - command in the any sub - command group into the second command queue;
[0127] Wherein, the execution priority of the first command queue is higher than that of the second command queue.
[0128] In some embodiments, the priority determination unit is specifically configured to:
[0129] Add an execution mark to each sub - command in any sub - command group in the second command queue;
[0130] Wherein, the execution marks of each sub - command in the same sub - command group are the same; the execution marks of each sub - command in different sub - command groups are different.
[0131] In some embodiments, the execution unit is specifically configured to:
[0132] Determine the current sub - command based on the first command queue and the second command queue;
[0133] When the current sub - command includes an execution mark, determine the associated sub - command corresponding to the current sub - command in the second command queue based on the execution mark; the associated sub - command and the current sub - command belong to the same sub - command group;
[0134] Determine the execution result of the sub - command group corresponding to the current sub - command based on the execution result of the current sub - command and the execution result of the associated sub - command;
[0135] Determine the execution results of each data read - write command based on the execution results of each sub - command group corresponding to each data read - write command.
[0136] In some embodiments, the command group determination unit is specifically configured to:
[0137] Parse any data read - write command to determine multiple sub - commands corresponding to the any data read - write command, and the command words and storage addresses of each sub - command;
[0138] Determine the execution association relationship between each sub - command based on the command words and storage addresses of each sub - command;
[0139] Group multiple sub-commands corresponding to any data read / write command according to the execution association relationship between the sub-commands, to obtain multiple sub-command groups corresponding to any data read / write command.
[0140] In some embodiments, the multiple sub-commands corresponding to the data read / write command are determined based on the execution stage of the data read / write command in the solid-state drive.
[0141] Figure 4 is a schematic structural diagram of the solid-state drive provided by the present application. As Figure 4 shown, the solid-state drive 400 includes a control chip 410; the above-mentioned data read / write device 300 is provided in the control chip 410.
[0142] Figure 5 is a schematic structural diagram of the electronic device provided by the present application. As Figure 5 shown, the electronic device may include: a processor (Processor) 510, a communication interface (Communications Interface) 520, a memory (Memory) 530, and a communication bus (Communications Bus) 540. Among them, the processor 510, the communication interface 520, and the memory 530 complete mutual communication through the communication bus 540. The processor 510 can call the logical commands in the memory 530 to execute the following method:
[0143] Obtain multiple data read / write commands corresponding to the current channel; determine multiple sub-command groups corresponding to each data read / write command based on the multiple sub-commands corresponding to each data read / write command and the execution association relationship between the multiple sub-commands; determine the execution priority of each sub-command group corresponding to each data read / write command based on the execution duration of each sub-command group corresponding to each data read / write command; determine the execution result of each data read / write command in the current channel based on the execution priority of each sub-command group corresponding to each data read / write command.
[0144] In addition, when the logical commands in the above-mentioned memory are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several commands for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0145] The processor in the electronic device provided in the embodiments of this application can call the logical instructions in the memory to implement the above method. The specific implementation manner is the same as that of the foregoing method implementation manner, and the same beneficial effects can be achieved, which will not be elaborated here.
[0146] The embodiments of this application also provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is used to execute the methods provided in the above various embodiments.
[0147] The specific implementation manner is the same as that of the foregoing method implementation manner, and the same beneficial effects can be achieved, which will not be elaborated here.
[0148] The embodiments of this application provide a computer program product, including a computer program. When the computer program is executed by a processor, it implements the method as described above.
[0149] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative labor.
[0150] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solution, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing 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.
[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of the present application.
Claims
1. A data reading and writing method, characterized in that, Including: Obtaining a plurality of data read / write commands corresponding to the current channel; Determining a plurality of sub-command groups corresponding to each data read / write command based on a plurality of sub-commands corresponding to each data read / write command and the execution association relationship between the plurality of sub-commands; Determining the execution priority of each sub-command group corresponding to each data read / write command based on the execution duration of each sub-command group corresponding to each data read / write command; Determining the execution result of each data read / write command in the current channel based on the execution priority of each sub-command group corresponding to each data read / write command; The determining the execution priority of each sub-command group corresponding to each data read / write command based on the execution duration of each sub-command group corresponding to each data read / write command includes: Determining the execution duration of any sub-command group corresponding to any data read / write command based on the execution duration of each sub-command in any sub-command group corresponding to any data read / write command; When the execution duration of the any sub-command group is less than the preset execution duration, dividing each sub-command in the any sub-command group into a first command queue; When the execution duration of the any sub-command group is greater than or equal to the preset execution duration, dividing each sub-command in the any sub-command group into a second command queue; Wherein, the execution priority of the first command queue is higher than that of the second command queue; The determining a plurality of sub-command groups corresponding to each data read / write command based on a plurality of sub-commands corresponding to each data read / write command and the execution association relationship between the plurality of sub-commands includes: Parsing any data read / write command to determine a plurality of sub-commands corresponding to the any data read / write command, as well as the command words and storage addresses of each sub-command; Determining the execution association relationship between each sub-command based on the command words and storage addresses of each sub-command; Grouping the plurality of sub-commands corresponding to the any data read / write command based on the execution association relationship between each sub-command to obtain a plurality of sub-command groups corresponding to the any data read / write command; The execution association relationship refers to the association relationship of sub-commands in the execution order, including concurrent execution or sequential execution.
2. The data reading and writing method according to claim 1, characterized in that, The dividing each sub-command in the any sub-command group into the second command queue includes: Adding an execution mark to each sub-command in the any sub-command group in the second command queue; Wherein, the execution marks of each sub-command in the same sub-command group are the same; the execution marks of each sub-command in different sub-command groups are different.
3. The data reading and writing method according to claim 2, characterized in that, The determining the execution result of each data read / write command in the current channel based on the execution priority of each sub-command group corresponding to each data read / write command includes: Determining the current sub-command based on the first command queue and the second command queue; When the current sub-command includes an execution mark, determining the associated sub-command corresponding to the current sub-command in the second command queue based on the execution mark; the associated sub-command and the current sub-command belong to the same sub-command group; Determine the execution result of the sub-command group corresponding to the current sub-command based on the execution result of the current sub-command and the execution result of the associated sub-command; Determine the execution result of each data read / write command based on the execution result of each sub-command group corresponding to each data read / write command.
4. The data reading and writing method according to any one of claims 1 to 3, characterized in that, The multiple sub-commands corresponding to the data read / write command are determined based on the execution stage of the data read / write command in the solid-state drive.
5. A data reading and writing device, characterized in that, Comprising: An acquisition unit, configured to acquire multiple data read / write commands corresponding to the current channel; A command group determination unit, configured to determine multiple sub-command groups corresponding to each data read / write command based on the multiple sub-commands corresponding to each data read / write command and the execution association relationship between the multiple sub-commands; A priority determination unit, configured to determine the execution priority of each sub-command group corresponding to each data read / write command based on the execution duration of each sub-command group corresponding to each data read / write command; An execution unit, configured to determine the execution result of each data read / write command in the current channel based on the execution priority of each sub-command group corresponding to each data read / write command; The priority determination unit is specifically configured to: Determine the execution duration of any sub-command group corresponding to any data read / write command based on the execution duration of each sub-command in any sub-command group corresponding to any data read / write command; In the case where the execution duration of any sub-command group is less than the preset execution duration, divide each sub-command in any sub-command group into a first command queue; In the case where the execution duration of any sub-command group is greater than or equal to the preset execution duration, divide each sub-command in any sub-command group into a second command queue; Wherein, the execution priority of the first command queue is higher than the execution priority of the second command queue; The command group determination unit is specifically configured to: Parse any data read / write command to determine the multiple sub-commands corresponding to any data read / write command, and the command word and storage address of each sub-command; Determine the execution association relationship between each sub-command based on the command word and storage address of each sub-command; Group the multiple sub-commands corresponding to any data read / write command based on the execution association relationship between each sub-command to obtain multiple sub-command groups corresponding to any data read / write command; The execution association relationship refers to the association relationship in the execution order of sub-commands, including concurrent execution or sequential execution.
6. A solid-state drive, characterized in that, Comprising a control chip; The data read / write device according to claim 5 is provided in the control chip.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program executes the data read / write method according to any one of claims 1 to 4 when running.
8. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to execute the data read / write method according to any one of claims 1 to 4 through the computer program.
Citation Information
Patent Citations
Storage device and data processing method thereof
CN115220641A
Controller of magnetic disk array and its working method
CN1752916A