Data writing method, electronic equipment and computer readable storage medium
During the data writing process of the UFS device, dynamically determine the number of configuration parameter flow and write commands based on the write data, and synchronously execute the write command and remaining configuration when some configuration is completed, the write performance of UFS device is solved. The impact of parameter calculation and timing configuration achieves more efficient write performance.
Patent Information
- Application Number
- CN202311054297.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-21
- Publication Date
- 2025-02-21
AI Technical Summary
During the data writing process of UFS devices, time loss caused by the calculation of parameters related to the write command and timing configuration, affecting the writing performance of the storage device.
By obtaining the write data, the number of configuration parameter flow and the corresponding write commands are determined based on the write data, and when the part of the configuration parameter flow is completed, the writing commands corresponding to the part of the configuration process parameters are executed, and the remaining part of the configuration is synchronized. Configuration of parameter flow.
The time loss of configuration parameters in the entire write process is reduced and the writing performance of the storage device is improved.
Smart Images

Figure CN119493520A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage, and in particular to a data writing method, an electronic device and a computer-readable storage medium. Background Art
[0002] As a data storage device, UFS devices are widely used in more and more fields. UFS devices use the internal master to perform SinglePlane write or MultiPlane write to store data in NAND. The usual data writing process is that the master first calculates the parameters related to the write command, configures the timing related to the write command, and then starts the command queue to write the data to NAND with the write command. The parameter calculation and timing configuration before the write command will cause a lot of time loss, affecting the write performance of the storage device. Summary of the invention
[0003] The main purpose of the present application is to provide a data writing method, an electronic device and a computer-readable storage medium, which can improve the writing performance of a storage device.
[0004] In order to solve the above technical problems, the first technical solution adopted by the present application is: to provide a data writing method. The method includes obtaining writing data, and determining the number of configuration parameter processes and the corresponding writing commands based on the writing data; wherein each configuration parameter process is used to perform parameter configuration related to the writing command before executing the corresponding writing command; in response to completing part of the configuration parameter process, executing the writing command corresponding to the part of the configuration parameter process, and synchronously performing the configuration of at least one of the remaining part of the configuration parameter process.
[0005] To solve the above technical problem, the second technical solution adopted by the present application is to provide an electronic device, which includes a memory and a processor, wherein the memory is used to store program data, and the program data can be executed by the processor to implement the method described in the first technical solution.
[0006] To solve the above technical problems, the third technical solution adopted by the present application is to provide a computer-readable storage medium. The computer-readable storage medium stores program data and can be executed by a processor to implement the method described in the first technical solution.
[0007] The beneficial effect of the present application is that after obtaining write data and determining the number of configuration parameter processes and the corresponding write commands based on the write data, unlike the prior art that completes all configuration parameter processes and then executes the write commands, the present application executes the write commands corresponding to the parameters of part of the configuration parameter processes when part of the configuration parameter processes are completed and simultaneously configures the remaining configuration parameter processes, so that part of the configuration parameter processes are executed first, and then the corresponding write commands are directly executed, and when these write commands are executed, the remaining configuration parameter processes are performed in parallel, thereby reducing the time loss of configuring parameters in the entire write process and improving the write performance of the storage device. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0009] Figure 1 It is a flowchart of the first embodiment of the data writing method of the present application;
[0010] Figure 2 This is a schematic diagram of a conventional writing process;
[0011] Figure 3 This is a schematic diagram of a writing process of a specific embodiment of the present application;
[0012] Figure 4 It is a schematic diagram of a writing process of another specific embodiment of the present application;
[0013] Figure 5 It is a schematic diagram of a writing process of another specific embodiment of the present application;
[0014] Figure 6 It is a structural schematic diagram of the first embodiment of the electronic device of the present application;
[0015] Figure 7 It is a structural diagram of the first embodiment of the computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0016] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0017] The terms "first", "second", etc. in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0018] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0019] Reference Figure 1 , Figure 1 The flowchart of the first embodiment of data writing for this application includes the following steps:
[0020] S11: Acquire write data, and determine the number of configuration parameter processes and the corresponding write command based on the write data.
[0021] In the storage device, data writing is performed one by one according to the data size. For example, in the process of writing data to NAND, there is SinglePlane writing or MultiPlane writing. When the amount of data is less than a set threshold, SinglePlane writing is used, and when the amount of data is greater than the set threshold, MultiPlane writing is used. The set threshold corresponds to the amount of data of a Plane, and the writing is performed one by one according to the amount of data. According to the amount of data of the acquired write data and the set threshold, the number of data to be written can be obtained. When each data is written, the configuration of parameters and the execution of write commands are required. It is equivalent to determining the number of configuration parameter processes that need to be performed and the corresponding write commands. Parameter configuration includes the configuration of timing and DMA, which can specifically include at least one of calculating the time to write the data address, configuring the write command timing, and configuring DMA. DMA is a write command for data writing. When the storage device receives the write data, it will receive the logical address and actual data of the data, and then the master needs to calculate the logical address to obtain the physical address for writing, and the time spent on the calculation is the time to calculate the write data address.
[0022] For example, three writes, P1, P2 and P3, are determined based on the write data, and it is determined that three configuration parameter processes need to be performed and three write commands need to be executed.
[0023] Each parameter configuration process is used to configure the parameters related to the write command before executing the corresponding write command. Parameter configuration needs to be performed before data can be written using the write command. As a whole, the parameter configuration process can only be executed in the subsequent write command when all configurations in a parameter configuration process are completed.
[0024] S12: In response to completing a portion of the configuration parameter process, executing a write command corresponding to the portion of the configuration parameter process, and simultaneously performing configuration of at least one of the remaining portions of the configuration parameter process.
[0025] Instead of waiting for all configuration parameter processes to be completed before executing the write command, the write command corresponding to the part of the configuration parameter process is executed after the part of the configuration parameter process is completed, and at least one of the remaining configuration parameter processes is configured while executing the write command. The part of the configuration parameter process is synchronized with the write command to reduce the overall write time.
[0026] In this embodiment, after obtaining write data and determining the number of configuration parameter processes and the corresponding write commands based on the write data, when completing part of the configuration parameter process, the write commands corresponding to the parameters of the part of the configuration parameter process are executed and the configuration of the remaining part of the configuration parameter process is performed simultaneously, so that a part of the configuration parameter process is executed first, and then the corresponding write commands are directly executed, and when these write commands are executed, the remaining configuration parameter processes are performed in parallel, thereby reducing the time loss of configuring parameters in the entire write process and improving the write performance of the storage device.
[0027] In the technical solution of the present application, the configuration parameter flow that is performed synchronously with the write command can be a part of the remaining configuration parameter flow, or it can be the entirety of the remaining configuration parameter flow. The case of configuring a part of the remaining configuration parameter flow can be, for example, three writes, P1, P2 and P3, are determined according to the write data. After completing the parameter configuration flow of P1, execute the write command of P1, and synchronously perform the parameter configuration flow of P2. When the P2 parameter configuration flow is completed and the P1 write command is completed, execute the write command of P2. When the P2 write command is completed, perform the parameter configuration flow of P3. Then the P1 parameter configuration flow is the partial parameter configuration flow that is completed first, and the P2 and P3 parameter configuration flows are the remaining parameter configuration flows. The P2 parameter configuration flow is a part of the remaining configuration parameter flow, which is performed synchronously with the P1 write command. The case of configuring all of the remaining configuration parameter flows can be, for example, three writes, P1, P2 and P3, are determined according to the write data. After completing the parameter configuration flow of P1, execute the write command of P1, and synchronously perform the parameter configuration flows of P2 and P3. The P1 parameter configuration process is the partial parameter configuration process that is completed first, and the P2 and P3 parameter configuration processes are the entirety of the remaining parameter configuration processes, which are performed synchronously with the P1 write command.
[0028] In one embodiment, a write command corresponding to a partial configuration parameter process is executed, and configuration of at least one of the remaining partial configuration parameter processes is performed synchronously, including: when one of the write commands corresponding to the partial configuration parameter process starts to be executed, configuration of at least one of the remaining partial configuration parameter processes is started.
[0029] For example, three writes are determined based on the write data, P1, P2, and P3. After completing the parameter configuration process of P1 and P2, the write commands of P1 and P2 are executed, and the parameter configuration process of P3 is performed simultaneously. The parameter configuration process of P3 can be performed when the write command of P1 is executed, or it can be selected to be performed when the write command of P2 is executed.
[0030] In one embodiment, when one of the write commands corresponding to the execution of the partial configuration parameter process begins to be executed, the configuration of at least one of the remaining configuration parameter processes begins, including: when the first write command begins to be executed, the configuration of at least one of the remaining configuration parameter processes begins.
[0031] For example, three writes are determined based on the write data, P1, P2 and P3. After completing the parameter configuration process of P1 and P2, the write commands of P1 and P2 are executed, and the parameter configuration process of P3 is performed simultaneously. The parameter configuration process of P3 is performed when the write command of P1 is executed.
[0032] The parallel time of the parameter configuration process can be selected according to the actual situation. Completing the parameter configuration process as early as possible can avoid affecting the subsequent use of master control resources.
[0033] In one embodiment, the execution time of one write command is greater than the configuration time of the remaining configuration parameter processes. In this case, all the remaining configuration parameter processes can be completed during the execution of one write command.
[0034] In one embodiment, the configuration of the remaining configuration parameter flow is performed continuously. The remaining parameter configuration flow can be executed without interval. For example, three writes are determined based on the write data, P1, P2 and P3. After completing the parameter configuration flow of P1, the write command of P1 is executed, and the parameter configuration flow of P2 and P3 is performed synchronously. When the write command of P1 starts to be executed, the parameter configuration flow of P2 is started. When the parameter configuration flow of P2 is completed, the parameter configuration flow of P3 is immediately executed.
[0035] In one embodiment, the execution of the remaining configuration parameter flow may also be performed discontinuously. For example, executing the write command corresponding to the part of the configuration parameter flow and synchronously configuring at least one of the remaining configuration parameter flows includes: synchronously configuring one of the remaining configuration parameter flows during the execution of the current write command to form the next write command. However, the premise of discontinuity requires that the execution time of a write command is greater than the time of a parameter configuration flow.
[0036] For example, three writes are determined based on the write data, P1, P2, and P3. After completing the parameter configuration process of P1, execute the write command of P1, and synchronously perform the parameter configuration process of P2. After completing the write command of P1, execute the write command of P2, and synchronously perform the parameter configuration process of P3.
[0037] In one embodiment, in response to completing a partial configuration parameter process, executing a write command corresponding to the partial configuration parameter process, and synchronously performing configuration of at least one of the remaining partial configuration parameter processes, including: in response to completing a configuration parameter process, executing a write command corresponding to the configuration parameter process, and synchronously performing configuration of at least one of the remaining configuration parameter processes.
[0038] When a write command is executed directly after completing a parameter configuration process, and the remaining parameter configuration processes are all configured and completed during the execution of the write command, the loss time of the overall write process for the parameter configuration process can be minimized, thereby improving the write performance of the storage device. The steps of synchronously performing the parameter configuration process can refer to the above embodiment.
[0039] Several specific embodiments are given below to illustrate the technical solution of the present application in more detail.
[0040] In general, take writing 4 planes at a time as an example. Figure 2 As shown, Figure 2 This is a schematic diagram of a conventional write process. The write process includes 4 parameter configuration processes and 4 write command execution processes (P0, P1, P2 and P3). 80h, 11h, 10h and 15h are write command instructions CMD. Add is the write address. Data is the data to be written. CPU consumption is the time required for the CPU to configure, that is, tCpu. The time for a write command to execute is tProg. For storage devices, tProg is often a fixed time, so the performance of data writing will be mainly affected by tCpu. When the CPU software overhead increases, it will lead to a decrease in data writing performance.
[0041] In the technical solution of this application, if Figure 3 As shown, Figure 3 This is a schematic diagram of a write process of a specific embodiment of the present application. After executing a parameter configuration process of P0, it directly executes the P0 write command and synchronously executes the parameter configuration processes of P1, P2 and P3, thereby reducing the loss time of the entire data writing process for the parameter configuration process, so as to improve the write performance of the storage device.
[0042] As long as MultiPlane writing is performed, whether it is 2Plane, 3Plane or other larger numbers, the technical solution of the present application can be used to improve the writing performance of the storage device. Figure 4 As shown, Figure 4 This is a schematic diagram of a write process of another specific embodiment of the present application. It is a one-time write 2Plane. After executing a parameter configuration process of P0, it directly executes the P0 write command and synchronously executes the parameter configuration process of P1.
[0043] like Figure 5 As shown, Figure 5Here is another specific embodiment of the present application, a schematic diagram of a write process. Taking the one-time write 4Plane as an example, its write process includes 4 parameter configuration processes and 4 write command execution processes (P0, P1, P2 and P3). After executing a parameter configuration process of P0, it directly executes the P0 write command and synchronously executes the parameter configuration process of P1. After the P0 write command is completed, the P1 parameter configuration process is also completed, so the P1 write command continues to be executed. After the P1 write command is completed, like the conventional process, the parameter configuration process of P2 and P3 is executed, and then the write commands of P2 and P3 are executed. The execution of the P2 and P3 parameter configuration and write command can be as shown in the figure, or it can be the same as P0 and P1, first completing the parameter configuration of P2, and then executing the write command of P2 and the parameter configuration process of P3 in parallel, and finally executing the write command of P3.
[0044] like Figure 6 As shown, Figure 6 This is a schematic structural diagram of the first embodiment of the electronic device of the present application.
[0045] The electronic device includes a processor 110 and a memory 120 .
[0046] The processor 110 controls the operation of the electronic device, and the processor 110 may also be referred to as a CPU (Central Processing Unit). The processor 110 may be an integrated circuit chip having the ability to process a signal sequence. The processor 110 may also be a general-purpose processor, a digital signal sequence processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0047] The memory 120 stores instructions and program data required for the processor 110 to operate.
[0048] The processor 110 is used to execute instructions to implement the method provided by any embodiment and possible combination of the aforementioned data writing method of the present application.
[0049] like Figure 7 As shown, Figure 7 This is a schematic diagram of the structure of the first embodiment of the computer-readable storage medium of the present application.
[0050] An embodiment of a readable storage medium of the present application includes a memory 210, and the memory 210 stores program data. When the program data is executed, the method provided by any embodiment and possible combination of the data writing method of the present application is implemented.
[0051] The memory 210 may include a medium that can store program instructions, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or it may be a server that stores the program instructions. The server may send the stored program instructions to other devices for execution, or it may execute the stored program instructions itself.
[0052] To summarize, after obtaining write data and determining the number of configuration parameter processes and the corresponding write commands based on the write data, when completing part of the configuration parameter process, the write commands corresponding to the parameters of the part of the configuration parameter process are executed and the configuration of the remaining part of the configuration parameter process is performed simultaneously, so that a part of the configuration parameter process is executed first, and then the corresponding write commands are executed directly, and when these write commands are executed, the remaining configuration parameter processes are performed in parallel, thereby reducing the time loss of configuring parameters in the entire write process and improving the write performance of the storage device.
[0053] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only illustrative, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0054] 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 on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0055] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0056] If the integrated units in the above other embodiments 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 this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or 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 a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program codes.
[0057] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data writing method, characterized in that: The method comprises: Acquire write data, and determine the number of configuration parameter processes and the corresponding write command based on the write data; wherein each of the configuration parameter processes is used to configure parameters related to the write command before executing the corresponding write command; In response to completing a partial configuration parameter process, a write command corresponding to the partial configuration parameter process is executed, and configuration of at least one of the remaining partial configuration parameter processes is performed simultaneously.
2. The method according to claim 1, characterized in that The executing the write command corresponding to the partial configuration parameter process and simultaneously configuring at least one of the remaining partial configuration parameter processes includes: When one of the write commands corresponding to the partial configuration parameter processes starts to be executed, the configuration of at least one of the remaining partial configuration parameter processes begins.
3. The method according to claim 2, characterized in that When one of the write commands corresponding to the execution of the partial configuration parameter process begins to be executed, configuration of at least one of the remaining partial configuration parameter processes begins, including: When the first write command starts to be executed, the configuration of at least one of the remaining configuration parameter processes begins.
4. The method according to claim 1, characterized in that The execution time of one of the write commands is greater than the configuration time of the remaining configuration parameter processes.
5. The method according to claim 1, characterized in that The configuration of the remaining configuration parameter process is performed continuously.
6. The method according to claim 1, characterized in that The executing the write command corresponding to the partial configuration parameter process and simultaneously configuring at least one of the remaining partial configuration parameter processes includes: During the execution of the current write command, one of the remaining configuration parameter processes is configured synchronously to form the next write command.
7. The method according to claim 1, characterized in that In response to completing a portion of the configuration parameter flow, executing a write command corresponding to the portion of the configuration parameter flow, and synchronously configuring at least one of the remaining portions of the configuration parameter flow, includes: In response to completing one configuration parameter process, the write command corresponding to the configuration parameter process is executed, and configuration of at least one of the remaining configuration parameter processes is performed synchronously.
8. The method according to claim 1, characterized in that The parameter configuration includes at least one of calculating the time to write a data address, configuring a write command timing, and configuring DMA.
9. An electronic device, characterized in that: The invention comprises a memory and a processor, wherein the memory is used to store program data, and the program data can be executed by the processor to implement the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: Program data is stored and can be executed by a processor to implement the method according to any one of claims 1 to 8.