Data storage method, device, system, readable storage medium and electronic equipment
Patent Information
- Application Number
- CN202310443152.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-23
- Publication Date
- 2026-10-13
- Estimated Expiration
- 2043-04-23
AI Technical Summary
[0005]本申请实施例提供了一种数据存储方法、装置、系统、可读存储介质及电子设备,以至少解决由于相关技术中需要在多个数据处理模块中选择一个数据处理模块对目标写命令进行统一分发处理,导致的数据存储的效率低的技术问题
[0017]根据本申请的又一个实施例,还提供了一种电子设备,包括存储器和处理器,存储器中存储有计算机程序,处理器被设置为运行计算机程序以执行上述任一项数据存储方法实施例中的步骤。
Smart Images

Figure CN116501253B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a data storage method, apparatus, system, readable storage medium, and electronic device. Background Technology
[0002] To support various use cases of ZNS SSD (Zoned Namespaces solid state disk), the ZNS protocol supports the append function, which is an append write command.
[0003] Currently, ZNS SSD controllers are generally multi-core architectures. To achieve better performance, they typically have multiple data processing modules (Data Manager, DM), each running on an independent data core. When the firmware processes append command requests, to ensure the sequential increment of the write pointer WP, a data core is selected as the distribution processing module. In other words, a data processing module is chosen from among the multiple data processing modules to uniformly distribute and process the target write command (i.e., the append command). When the number of data processing modules is large, the performance becomes limited by the performance of the distribution processing module, resulting in low data storage efficiency.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This application provides a data storage method, apparatus, system, readable storage medium, and electronic device to at least solve the technical problem of low data storage efficiency caused by the need to select one data processing module from multiple data processing modules to uniformly distribute and process target write commands in related technologies.
[0006] According to one embodiment of this application, a data storage method is provided, comprising: determining the block state of a target block corresponding to a target write command, wherein the target write command is a command issued by a host for writing target data to a storage space; when the block state is a first state, determining a target storage unit based on a write pointer corresponding to the target block, and calling an interval engine to lock the target storage unit, wherein the write pointer is used to indicate the target address of the last storage unit in the target block that already stores data, and the target storage unit is a storage unit where the target data is planned to be stored; and storing the target data obtained from the host into the target storage unit.
[0007] In an exemplary embodiment, the target write command includes: the starting address of the target block where the target data is planned to be stored, and the target quantity, wherein the target quantity is the number of storage units required by the target data, and each storage unit corresponds to a target address; determining the block status of the target block corresponding to the target write command includes: determining the target block corresponding to the target write command based on the starting address; determining the block status of the target block, wherein the block status includes: a first status and a second status, the first status being used to indicate that there are free storage units in the target block, and the second status being used to indicate that all storage units in the target block have been filled.
[0008] In an exemplary embodiment, determining the target storage unit based on the write pointer corresponding to the target block includes: determining the target address of the last storage unit that has stored data, as indicated by the write pointer of the target block; and determining a target number of storage units immediately following the last storage unit that has stored data as the target storage units.
[0009] In an exemplary embodiment, the interval engine is used to lock the target storage unit according to the order in which they are called; calling the interval engine to lock the target storage unit includes: if there is no locked target storage unit in the target storage unit, locking the target storage unit and determining that the locking is successful; and if there is a locked target storage unit in the target storage unit, determining that the locking fails.
[0010] In one exemplary embodiment, storing target data obtained from the host into the target storage unit includes: if the target storage unit is successfully locked, updating the write pointer and determining whether the target address indicated by the updated write pointer exceeds the address range of the target block; if the target address does not exceed the address range of the target block, storing the target data into the target storage unit.
[0011] In an exemplary embodiment, the address range of the target block is determined by the start address and end address of the target block; updating the write pointer and determining whether the target address indicated by the updated write pointer exceeds the address range of the target block includes: determining the target address corresponding to the last target storage unit in the target storage unit as the target address indicated by the updated write pointer; if the target address indicated by the updated write pointer is not greater than the end address of the target block, determining that the target address indicated by the updated write pointer does not exceed the address range of the target block; and if the target address indicated by the updated write pointer is greater than the end address of the target block, determining that the target address indicated by the updated write pointer exceeds the address range of the target block, and unlocking the target storage unit that has been successfully locked.
[0012] In one exemplary embodiment, the method further includes: updating the block state of the target block to a second state if the target address indicated by the updated write pointer is consistent with the end address of the target block.
[0013] In one exemplary embodiment, storing target data in a target storage unit includes: acquiring target data and storing the target data in a write buffer; unlocking a target storage unit that has been successfully locked, wherein the write buffer is used to write the target data into the corresponding target storage unit when the write buffer is full.
[0014] According to another embodiment of this application, a data storage device is provided, comprising: a status confirmation module, configured to determine the block status of a target block corresponding to a target write command, wherein the target write command is a command issued by a host to write target data to a storage space; a locking processing module, configured to, when the block status is in a first state, determine a target storage unit based on a write pointer corresponding to the target block, and call an interval engine to lock the target storage unit, wherein the write pointer is used to indicate the target address of the last storage unit in the target block that already stores data, and the target storage unit is a storage unit where target data is planned to be stored; and a data storage module, configured to store target data obtained from the host into the target storage unit.
[0015] According to another embodiment of this application, a data storage system is provided, including: a scheduling module, an interval engine, and multiple data processing modules. The scheduling module is used to receive a target write command issued by a host and forward the target write command to the data processing modules. The interval engine is used for multiple data processing modules to call and lock target storage units according to the order in which they are called. The data processing modules are used to determine the block state of the target block corresponding to the target write command, wherein the target write command is a command issued by the host to write target data to the storage space. When the block state is in the first state, the target storage unit is determined according to the write pointer corresponding to the target block, and the interval engine is called to lock the target storage unit. The write pointer is used to indicate the target address of the last storage unit in the target block that already stores data, and the target storage unit is the storage unit where the target data is planned to be stored. The target data obtained from the host is stored in the target storage unit.
[0016] According to yet another embodiment of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in any of the above-described data storage method embodiments when it is run.
[0017] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to perform the steps in any of the above-described data storage method embodiments.
[0018] This application designs a multi-core concurrent processing scheme. Each Data Controller (DM) independently requests an Interval Engine to lock the Logical Block Address (LBA) to be written. After acquiring the lock, it increments and checks the Write Pointer (WP), enabling multiple DMs to process concurrently. This eliminates the need to forward the data to a distribution module to ensure the uniqueness of the WP in the target block information (zone Info). Therefore, it solves the problem of low data storage efficiency caused by the need to select one data processing module from multiple data processing modules for unified distribution of target write commands in related technologies, achieving the effect of enabling multiple data processing modules to process target write commands concurrently. Attached Figure Description
[0019] Figure 1 This is a hardware structure block diagram of a computer device for implementing a data storage method according to an embodiment of this application;
[0020] Figure 2 This is a flowchart of a data storage method provided according to an embodiment of this application;
[0021] Figure 3 This is a flowchart of a ZNS append multi-core concurrent processing method provided according to an embodiment of this application;
[0022] Figure 4 This is a schematic diagram of the structure of a data storage device according to an embodiment of this application;
[0023] Figure 5 This is a schematic diagram of a data storage system provided according to an embodiment of this application. Detailed Implementation
[0024] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.
[0025] To facilitate a better understanding of the embodiments of this application by those skilled in the art, some technical terms or nouns involved in the embodiments of this application are explained as follows:
[0026] ZNS (Zoned Namespaces): A solution based on the NVMe protocol;
[0027] SSD (State Disk Solid): Solid-state electronic storage array hard drive;
[0028] ZONE: The unit used for management in ZNS SSD (Zoned Namespaces solid state disk);
[0029] DMA (Direct Memory Access): Direct Memory Access Unit;
[0030] Append command: An append write function supported by ZNS SSD;
[0031] DM (Data Manager): The data processing module in the firmware of ZNS SSD;
[0032] WP (Write Pointer): The write pointer for ZNS;
[0033] Interval engine: A hardware unit that locks LBA.
[0034] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0035] ZNS is a solution based on the NVMe protocol, offering advantages over traditional SSDs such as smaller write amplification and lower cost. Generally, ZNS SSDs support sequential writes. Therefore, before configuring and using a ZNS SSD, it's necessary to obtain the configuration information of all zones within the SSD to accurately determine the write pointers and status of each zone. The command `reportzone` is implemented based on the zone management receive command in the ZNS protocol. To support various use cases for ZNS SSDs, the ZNS protocol supports append functionality, a type of append write where the host sends an append command containing only the start LBA of the zone and the number of LBAs to be written.
[0036] ZNS SSD controllers typically employ a multi-core architecture. For better performance, they generally have multiple Data Controllers (DMs), each running on an independent data core. When the firmware processes append command requests, to ensure the sequential increment of the write pointer (WP), a data core is selected as the distribution processing module. Each DM forwards the write request for the LBA (Level Buffer Object) to the distribution processing module, which then sequentially increments the WP and writes the LBA to the buffer (BUFF). This approach works well when the number of DMs is small (e.g., less than four). However, when the number of DMs is large (e.g., more than seven), performance becomes limited by the distribution processing module, leading to low data storage efficiency.
[0037] To address the aforementioned problems, this application provides corresponding solutions, which are detailed below.
[0038] The methods and embodiments provided in this application can be executed in a computer device, computer terminal, or similar computing device. Taking execution on a computer device as an example, Figure 1 This is a hardware structure block diagram of a computer device for implementing a data storage method, according to an embodiment of this application. Figure 1 As shown, a computer device may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The computer device may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer device described above. For example, the computer device may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0039] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the data storage method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to computer devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0040] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer equipment. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0041] This embodiment provides a data storage method running on the aforementioned computer device. Figure 2 This is a flowchart of a data storage method provided according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:
[0042] Step S202: Determine the block status of the target block corresponding to the target write command, wherein the target write command is a command issued by the host to write target data to the storage space;
[0043] In the technical solution provided in step S202, the target write command includes: the starting address of the target block into which the target data is planned to be stored, and the target quantity, wherein the target quantity is the number of storage units required by the target data, and each storage unit corresponds to a target address;
[0044] In this embodiment, the target write instruction is an append command. The append command issued by the host only contains the starting LBA (i.e., the starting address) of the zone (i.e., the target block) and the number of LBAs to be written (i.e., the target quantity).
[0045] In some embodiments of this application, determining the block status of the target block corresponding to the target write command includes the following steps: determining the target block corresponding to the target write command based on the starting address; determining the block status of the target block, wherein the block status includes: a first state and a second state, the first state being used to indicate that there are free storage units in the target block, and the second state being used to indicate that all storage units in the target block have been filled.
[0046] Specifically, the data processing module DM uses the startLBA (the starting address of the target block) in the append command (i.e., the target write command) to determine the hit zone (i.e., the target block) and then determines the block status of the target block zone.
[0047] Step S204: When the block state is in the first state, the target storage unit is determined according to the write pointer corresponding to the target block, and the interval engine is called to lock the target storage unit. The write pointer is used to indicate the target address of the last storage unit in the target block that has stored data. The target storage unit is the storage unit where the target data is planned to be stored.
[0048] In some embodiments of this application, determining the target storage unit based on the write pointer corresponding to the target block includes the following steps: determining the target address of the last storage unit that has stored data, as indicated by the write pointer of the target block; and determining the target number of storage units immediately following the last storage unit that has stored data as the target storage units.
[0049] Specifically, if the target block zone corresponding to the target write command is an active zone (i.e., one of the first states mentioned above), then the DM will request a lock from the Interval engine hardware unit (i.e., the interval engine mentioned above). The range of the lock is from the write pointer WP of the current zone to WP+NumLBA, which is the target number of storage units immediately following the last storage unit that already contains data.
[0050] If the target block zone corresponding to the target write command is an empty zone (i.e., another case in the first state above), the open zone will be hidden first, and then a lock will be requested from the Interval engine hardware unit (i.e., the interval engine mentioned above).
[0051] In ZNS SSDs, there may be multiple DMs making similar locking requests. To ensure that multiple DMs can work concurrently, in some embodiments of this application, an interval engine is used to lock the target storage unit according to the order in which they are called. Calling the interval engine to lock the target storage unit includes the following steps: if there is no target storage unit that has already been locked, lock the target storage unit and determine that the locking is successful; and if there is a target storage unit that has already been locked, determine that the locking fails.
[0052] Specifically, the Interval engine hardware unit processes lock requests in the order they are received. Requests that do not overlap with an already locked LBA (i.e., there is no locked target storage unit among the aforementioned target storage units) are granted locks and the WP is updated. Otherwise, the lock request fails, the lock is released, a completion message is returned to the host, and the status is marked as the I / O append processing failed.
[0053] Step S206: The target data obtained from the host is stored in the target storage unit.
[0054] In some embodiments of this application, storing target data obtained from the host into the target storage unit includes the following steps: if the target storage unit is successfully locked, update the write pointer and determine whether the target address indicated by the updated write pointer exceeds the address range of the target block; if the target address does not exceed the address range of the target block, store the target data into the target storage unit.
[0055] In some embodiments of this application, the address range of the target block is determined by the start address and end address of the target block; updating the write pointer and determining whether the target address indicated by the updated write pointer exceeds the address range of the target block includes the following steps: determining the target address corresponding to the last target storage unit in the target storage unit as the target address indicated by the updated write pointer; if the target address indicated by the updated write pointer is not greater than the end address of the target block, determining that the target address indicated by the updated write pointer does not exceed the address range of the target block; and if the target address indicated by the updated write pointer is greater than the end address of the target block, determining that the target address indicated by the updated write pointer exceeds the address range of the target block, and unlocking the target storage unit that has been successfully locked.
[0056] In some embodiments of this application, storing target data in a target storage unit includes the following steps: acquiring target data and storing the target data in a write buffer; unlocking a target storage unit that has been successfully locked, wherein the write buffer is used to write the target data to the corresponding target storage unit when the write buffer is full.
[0057] Specifically, when the IO of the append command acquires the lock, that is, after the lock is successfully acquired, the write pointer WP in the target block information zone info will be updated, and then it will be determined whether the write pointer WP is greater than the endLBA (i.e. the above end address) of the target block zone.
[0058] If the target address indicated by the write pointer is less than or equal to endLBA (i.e., the aforementioned end address), the target data is moved from the host side to the write buffer (write cache area) in the SSD through the DMA unit. Then, the data processing module DM will return a completion message to the host and mark the status as the append write successful, and then release the lock, that is, unlock the target storage unit that has been successfully locked. If the target address indicated by the write pointer is greater than endLBA (i.e., the aforementioned end address), a failure message is returned to the host and the lock is released, that is, unlock the target storage unit that has been successfully locked.
[0059] Once the entire write buffer is full, meaning the write buffer is full of data, the firmware will write the target data from the write buffer to the corresponding target storage unit in the NAND flash memory, and then release the write buffer for other append commands to process.
[0060] As an optional implementation, the method further includes the following step: if the target address indicated by the updated write pointer is consistent with the end address of the target block, update the block status of the target block to the second state.
[0061] Specifically, if the target address indicated by the write pointer is equal to endlba (i.e., the end address mentioned above), the data processing module DM also needs to reacquire the lock of the entire target block zone and then change the block state of the target block zone to FULL state (i.e., the second state mentioned above).
[0062] The data storage method in steps S202 to S206 of the embodiments of this application will be further described below.
[0063] Figure 3 This is a flowchart of a ZNS append multi-core concurrent processing method provided according to an embodiment of this application, such as... Figure 3 As shown, the method includes the following steps:
[0064] In this embodiment, we will take the case of a ZNS SSD containing 8 data processing modules (DM) as an example.
[0065] Step 1: The host sends an append command (i.e., the target write command mentioned above). After receiving the append command from the host, the scheduling module iodispatcher in the firmware will distribute it to 8 data processing modules (DM) for processing. Each DM module will first determine the validity of the append command after receiving it. If the append command is valid, it will proceed to step 2 for processing. If it is invalid, it will directly return completion to the host and mark the status as an invalid command.
[0066] Step 2, 2) When the append command is valid, the data processing module DM uses the startLBA (i.e., the starting address of the target block) in the append command (i.e., the target write command) to determine the hit zone (i.e., the target block), and then determines the block status of the target block zone.
[0067] If the target block zone corresponding to the target write command is an active zone (i.e., one of the first states mentioned above), then the DM will request a lock from the Interval engine hardware unit (i.e., the interval engine mentioned above). The range of the lock is the range from the write pointer WP of the current zone to WP+NumLBA, which is the target number of storage units immediately following the last storage unit that already contains data.
[0068] If the target block zone corresponding to the target write command is an empty zone (i.e., another case in the first state above), the open zone will be hidden first, and then a lock will be requested from the Interval engine hardware unit (i.e., the interval engine mentioned above).
[0069] Step 3: In ZNS SSD, there may be multiple DMs making similar lock requests. To ensure that multiple DMs can work concurrently, the Interval engine hardware unit will process the lock requests in the order they are received. Requests that do not overlap with an already locked LBA (i.e., there is no locked target storage unit among the above target storage units) will be granted a lock and the WP will be updated. Otherwise, the lock request will fail, the lock will be released, a completion message will be returned to the host, and the status will be marked as the I / O append processing failed.
[0070] Step 4: When the IO of the append command acquires the lock, that is, after the lock is successfully acquired, the write pointer WP in the target block information zone info will be updated, and then it will be determined whether the write pointer WP is greater than the endLBA of the target block zone (i.e. the above end address).
[0071] If the target address indicated by the write pointer is less than or equal to endLBA (i.e., the aforementioned end address), the target data is moved from the host side to the write buffer (write cache area) in the SSD through the DMA unit. Then, the data processing module DM will return a completion message to the host and mark the status as the append write successful, and then release the lock, that is, unlock the target storage unit that has been successfully locked. If the target address indicated by the write pointer is greater than endLBA (i.e., the aforementioned end address), a failure message is returned to the host and the lock is released, that is, unlock the target storage unit that has been successfully locked.
[0072] If the target address indicated by the write pointer is equal to endlba (i.e., the end address mentioned above), the data processing module DM also needs to reacquire the lock of the entire target block zone and then change the block state of the target block zone to FULL state (i.e., the second state mentioned above).
[0073] Step 5: When the entire write buffer is full, that is, when the write buffer is full of data, the firmware will write the target data in the write buffer to the corresponding target storage unit in the NAND flash memory, and then release the write buffer for other append commands to process.
[0074] This application proposes a write scheme that enables multiple DMs to concurrently process append commands, thereby optimizing the append process, leveraging the advantages of multi-core CPU hardware, significantly increasing append bandwidth, enhancing product competitiveness, and resolving the performance bottleneck problem of the distribution processing module in previous technical solutions.
[0075] Through the above steps, each DM independently requests the Interval engine to lock the Logical Block Address (LBA) to be written. After acquiring the lock, it increments and checks the WritePointer (WP), allowing multiple DMs to process concurrently. This eliminates the need to forward the request to the distribution processing module to ensure the uniqueness of the WP in the target block information (zone Info). This eliminates the performance bottleneck of the CPU where the distribution processing module resides when multiple DMs are involved; it improves the bandwidth performance of the entire ZNS SSD's append write; and it solves the problem of low data storage efficiency caused by the need to select one data processing module from multiple data processing modules for unified distribution of target write commands in related technologies. This achieves the effect of enabling multiple data processing modules to process target write commands concurrently.
[0076] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, 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 is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0077] This embodiment also provides a data storage device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0078] Figure 4 This is a schematic diagram of the structure of a data storage device according to an embodiment of this application, such as... Figure 4 As shown, the device includes:
[0079] The status confirmation module 40 is used to determine the block status of the target block corresponding to the target write command, wherein the target write command is a command issued by the host to write target data to the storage space;
[0080] In some embodiments of this application, the target write command includes: the starting address of the target block where the target data is planned to be stored, and the target quantity, wherein the target quantity is the number of storage units required by the target data, and each storage unit corresponds to a target address;
[0081] In this embodiment, the target write instruction is an append command. The append command issued by the host only contains the starting LBA (i.e., the starting address) of the zone (i.e., the target block) and the number of LBAs to be written (i.e., the target quantity).
[0082] In some embodiments of this application, determining the block status of the target block corresponding to the target write command includes the following steps: determining the target block corresponding to the target write command based on the starting address; determining the block status of the target block, wherein the block status includes: a first state and a second state, the first state being used to indicate that there are free storage units in the target block, and the second state being used to indicate that all storage units in the target block have been filled.
[0083] The locking processing module 42 is used to determine the target storage unit based on the write pointer corresponding to the target block when the block state is in the first state, and call the interval engine to lock the target storage unit. The write pointer is used to indicate the target address of the last storage unit in the target block that has stored data. The target storage unit is the storage unit where the target data is planned to be stored.
[0084] In some embodiments of this application, determining the target storage unit based on the write pointer corresponding to the target block includes the following steps: determining the target address of the last storage unit that has stored data, as indicated by the write pointer of the target block; and determining the target number of storage units immediately following the last storage unit that has stored data as the target storage units.
[0085] In ZNS SSDs, there may be multiple DMs making similar locking requests. To ensure that multiple DMs can work concurrently, in some embodiments of this application, an interval engine is used to lock the target storage unit according to the order in which they are called. Calling the interval engine to lock the target storage unit includes the following steps: if there is no target storage unit that has already been locked, lock the target storage unit and determine that the locking is successful; and if there is a target storage unit that has already been locked, determine that the locking fails.
[0086] Data storage module 44 is used to store the target data obtained from the host into the target storage unit.
[0087] In some embodiments of this application, storing target data obtained from the host into the target storage unit includes the following steps: if the target storage unit is successfully locked, update the write pointer and determine whether the target address indicated by the updated write pointer exceeds the address range of the target block; if the target address does not exceed the address range of the target block, store the target data into the target storage unit.
[0088] In some embodiments of this application, the address range of the target block is determined by the start address and end address of the target block; updating the write pointer and determining whether the target address indicated by the updated write pointer exceeds the address range of the target block includes the following steps: determining the target address corresponding to the last target storage unit in the target storage unit as the target address indicated by the updated write pointer; if the target address indicated by the updated write pointer is not greater than the end address of the target block, determining that the target address indicated by the updated write pointer does not exceed the address range of the target block; and if the target address indicated by the updated write pointer is greater than the end address of the target block, determining that the target address indicated by the updated write pointer exceeds the address range of the target block, and unlocking the target storage unit that has been successfully locked.
[0089] In some embodiments of this application, the data storage module 44 is further configured to: update the block status of the target block to a second state when the target address indicated by the updated write pointer is consistent with the end address of the target block.
[0090] In some embodiments of this application, storing target data in a target storage unit includes the following steps: acquiring target data and storing the target data in a write buffer; unlocking a target storage unit that has been successfully locked, wherein the write buffer is used to write the target data to the corresponding target storage unit when the write buffer is full.
[0091] Through the above steps, each DM independently requests the Interval engine to lock the Logical Block Address (LBA) to be written. After acquiring the lock, it increments and checks the WritePointer (WP), allowing multiple DMs to process concurrently. This eliminates the need to forward the request to the distribution processing module to ensure the uniqueness of the WP in the target block information (zone Info). This eliminates the performance bottleneck of the CPU where the distribution processing module resides when multiple DMs are involved; it improves the bandwidth performance of the entire ZNS SSD's append write; and it solves the problem of low data storage efficiency caused by the need to select one data processing module from multiple data processing modules for unified distribution of target write commands in related technologies. This achieves the effect of enabling multiple data processing modules to process target write commands concurrently.
[0092] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0093] This embodiment also provides a data storage system for implementing the above embodiments and preferred embodiments, and details already described will not be repeated.
[0094] Figure 5 This is a schematic diagram of a data storage system according to an embodiment of this application, such as... Figure 5 As shown, the system includes: a scheduling module 50, an interval engine 52, and multiple data processing modules 54, wherein...
[0095] The scheduling module 50 is used to receive the target write command issued by the host and forward the target write command to the data processing module 54;
[0096] The interval engine 52 is used by multiple data processing modules 54 to call and lock the target storage unit according to the order in which they are called.
[0097] The data processing module 54 is used to determine the block status of the target block corresponding to the target write command, wherein the target write command is a command issued by the host to write target data to the storage space; when the block status is in the first state, the target storage unit is determined according to the write pointer corresponding to the target block, and the interval engine 52 is called to lock the target storage unit, wherein the write pointer is used to indicate the target address of the last storage unit in the target block that already stores data, and the target storage unit is the storage unit where the target data is planned to be stored; the target data obtained from the host is stored in the target storage unit.
[0098] In some embodiments of this application, the target write command includes: the starting address of the target block where the target data is planned to be stored, and the target quantity, wherein the target quantity is the number of storage units required by the target data, and each storage unit corresponds to a target address;
[0099] In some embodiments of this application, determining the block status of the target block corresponding to the target write command includes the following steps: determining the target block corresponding to the target write command based on the starting address; determining the block status of the target block, wherein the block status includes: a first state and a second state, the first state being used to indicate that there are free storage units in the target block, and the second state being used to indicate that all storage units in the target block have been filled.
[0100] In some embodiments of this application, determining the target storage unit based on the write pointer corresponding to the target block includes the following steps: determining the target address of the last storage unit that has stored data, as indicated by the write pointer of the target block; and determining the target number of storage units immediately following the last storage unit that has stored data as the target storage units.
[0101] In some embodiments of this application, storing target data obtained from the host into the target storage unit includes the following steps: if the target storage unit is successfully locked, update the write pointer and determine whether the target address indicated by the updated write pointer exceeds the address range of the target block; if the target address does not exceed the address range of the target block, store the target data into the target storage unit.
[0102] In some embodiments of this application, the address range of the target block is determined by the start address and end address of the target block; updating the write pointer and determining whether the target address indicated by the updated write pointer exceeds the address range of the target block includes the following steps: determining the target address corresponding to the last target storage unit in the target storage unit as the target address indicated by the updated write pointer; if the target address indicated by the updated write pointer is not greater than the end address of the target block, determining that the target address indicated by the updated write pointer does not exceed the address range of the target block; and if the target address indicated by the updated write pointer is greater than the end address of the target block, determining that the target address indicated by the updated write pointer exceeds the address range of the target block, and unlocking the target storage unit that has been successfully locked.
[0103] In some embodiments of this application, the data processing module 54 is further configured to: update the block status of the target block to a second state when the target address indicated by the updated write pointer is consistent with the end address of the target block.
[0104] In some embodiments of this application, storing target data in a target storage unit includes the following steps: acquiring target data and storing the target data in a write buffer; unlocking a target storage unit that has been successfully locked, wherein the write buffer is used to write the target data to the corresponding target storage unit when the write buffer is full.
[0105] This application proposes a write scheme that enables multiple DMs to concurrently process append commands, thereby optimizing the append process, leveraging the advantages of multi-core CPU hardware, significantly increasing append bandwidth, enhancing product competitiveness, and resolving the performance bottleneck problem of the distribution processing module in previous technical solutions.
[0106] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments at runtime, including: determining the block state of a target block corresponding to a target write command, wherein the target write command is a command issued by the host for writing target data to the storage space; when the block state is a first state, determining a target storage unit based on the write pointer corresponding to the target block, and calling an interval engine to lock the target storage unit, wherein the write pointer is used to indicate the target address of the last storage unit in the target block that already stores data, and the target storage unit is the storage unit where the target data is planned to be stored; and storing the target data obtained from the host into the target storage unit.
[0107] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0108] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0109] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0110] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0111] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0112] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A data storage method, characterized in that, include: Determine the block status of the target block corresponding to the target write command, wherein the target write command is a command issued by the host to write target data into the storage space; When the block state is in the first state, the target storage unit is determined according to the write pointer corresponding to the target block, including: determining the target address of the last storage unit that has stored data and is indicated by the write pointer of the target block; and determining the target number of storage units immediately following the last storage unit that has stored data as the target storage unit. Calling the interval engine to lock the target storage unit includes: locking the target storage unit if there is no locked target storage unit in the target storage unit, and determining that the locking is successful; and determining that the locking fails if there is a locked target storage unit in the target storage unit. The interval engine is used to lock the target storage units according to the order in which they are called, and the write pointer is used to indicate the target address of the last storage unit in the target block that already stores data. The target storage unit is the storage unit where the target data is planned to be stored. The target data obtained from the host is stored in the target storage unit.
2. The method according to claim 1, characterized in that, The target write command includes: the starting address of the target block where the target data is planned to be stored, and the target quantity, wherein the target quantity is the number of storage units required by the target data, and each storage unit corresponds to a target address; determining the block status of the target block corresponding to the target write command includes: Based on the starting address, determine the target block corresponding to the target write command; The block state of the target block is determined, wherein the block state includes a first state and a second state, the first state being used to indicate that there are free storage units in the target block, and the second state being used to indicate that all storage units in the target block have been filled.
3. The method according to claim 2, characterized in that, The process of storing the target data obtained from the host into the target storage unit includes: If the target storage unit is successfully locked, the write pointer is updated, and it is determined whether the target address indicated by the updated write pointer exceeds the address range of the target block; If the target address does not exceed the address range of the target block, the target data is stored in the target storage unit.
4. The method according to claim 3, characterized in that, The address range of the target block is determined by the start and end addresses of the target block; updating the write pointer and determining whether the target address indicated by the updated write pointer exceeds the address range of the target block includes: The target address corresponding to the last target storage unit in the target storage unit is determined as the target address indicated by the updated write pointer; If the target address indicated by the updated write pointer is not greater than the end address of the target block, it is determined that the target address indicated by the updated write pointer does not exceed the address range of the target block; and, If the target address indicated by the updated write pointer is greater than the end address of the target block, it is determined that the target address indicated by the updated write pointer exceeds the address range of the target block, and the target storage unit that has been successfully locked is unlocked.
5. The method according to claim 4, characterized in that, The method further includes: If the target address indicated by the updated write pointer is consistent with the end address of the target block, the block status of the target block is updated to the second status.
6. The method according to claim 3, characterized in that, Storing the target data into the target storage unit includes: Obtain the target data and store the target data in the write buffer; Unlock the target storage unit that has been successfully locked, wherein the write buffer is used to write the target data into the corresponding target storage unit when the write buffer is full.
7. A data storage device, characterized in that, include: The status confirmation module is used to determine the block status of the target block corresponding to the target write command, wherein the target write command is a command issued by the host to write target data to the storage space; A locking processing module is used to determine a target storage unit based on the write pointer corresponding to the target block when the block state is in the first state. This includes: determining the target address of the last storage unit containing data, as indicated by the write pointer of the target block; identifying a target number of storage units immediately following the last storage unit containing data as the target storage unit; and calling an interval engine to lock the target storage unit. This includes: locking the target storage unit if no locked target storage unit exists, and determining that the locking is successful; and determining that the locking fails if a locked target storage unit exists. The interval engine is used to lock the target storage units according to the order in which they are called, the write pointer indicates the target address of the last storage unit containing data in the target block, and the target storage unit is the storage unit where the target data is planned to be stored. A data storage module is used to store the target data obtained from the host into the target storage unit.
8. A data storage system, characterized in that, include: The system comprises a scheduling module, an interval engine, and multiple data processing modules. The scheduling module is used to receive the target write command issued by the host and forward the target write command to the data processing module; The interval engine is used for the multiple data processing modules to call, and locks the target storage unit according to the order in which they are called. The data processing module is used to determine the block status of the target block corresponding to the target write command, wherein the target write command is a command issued by the host to write target data to the storage space; when the block status is in the first state, the module determines the target storage unit based on the write pointer corresponding to the target block, and calls the interval engine to lock the target storage unit, wherein the write pointer is used to indicate the target address of the last storage unit in the target block that already stores data, and the target storage unit is the storage unit where the target data is planned to be stored; the target data obtained from the host is stored in the target storage unit.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the data storage method according to any one of claims 1 to 6.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the data storage method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data write-in method and solid-state drive array
CN110462577A
File system control method, device and equipment based on ZNS SSD
CN115543224A