Storage array data reading and writing method, controller, device, equipment and medium
By introducing a redundant module and a cache space management table into the storage array controller, the data reading and writing process is optimized, the problem of low data processing efficiency in the prior art is solved, and fast data processing and efficient data management are achieved.
Patent Information
- Application Number
- CN202411637678.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2044-11-15
AI Technical Summary
In the existing technology, the execution logic of the NVMe master is not designed based on the redundant storage array, resulting in low data processing efficiency and failure to take advantage of the independent redundant storage array.
By introducing redundant modules into the storage array controller and utilizing cache space management tables and virtual logical address partitioning technology, the data reading and writing processes are optimized, including the determination of cache address space and the data pre-reading mechanism, thereby improving data processing efficiency.
This enables rapid search for the cache address space of the target address stripe, reduces data read processing time, and improves the data processing efficiency of the storage array.
Smart Images

Figure CN119536652B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a storage array data reading and writing method, controller, device, equipment and medium. Background Art
[0002] The controller of the NVMe-oF / TCP flash storage array includes NVMe master, master memory and redundant array computing unit, such as Figure 1 As shown in the figure, the flash storage array establishes a connection with the remote host through the NVMe master, receiving and executing commands sent by the remote host. The NVMe master interacts with the NVMe storage disk to provide memory space and data transmission to the remote host.
[0003] In the existing technology, the execution logic of the NVMe master is not designed based on the redundant storage array, but is only managed by a remote host. As a result, the entire data end cannot take advantage of the independent redundant storage array, resulting in a time-consuming processing process and low data processing efficiency. Summary of the Invention
[0004] In view of this, embodiments of the present application provide a storage array data reading and writing method, controller, device, equipment and medium, which can effectively solve the problem of low efficiency in data reading and writing processing of the storage array.
[0005] In a first aspect, an embodiment of the present application provides a storage array data reading and writing method, which is applied to a storage array controller, wherein the storage array controller includes a storage interface control module, a redundancy module, a controller memory, and a non-volatile storage control module, including:
[0006] Determine the corresponding cache address space in the cache space management table according to the index of the target address stripe in the access command to the storage array;
[0007] According to the cache address space, the read and write data determined based on the access command to the storage array is cached in the controller memory; wherein
[0008] If the access command is a read command, reading target data and pre-read data according to the target address stripe and caching them in the controller memory; and
[0009] The target data is sent.
[0010] In some embodiments, determining the corresponding cache address space in a cache space management table based on an index of a target address stripe in a command to access the storage array includes:
[0011] Determining a target namespace and a target virtual logical address to be accessed according to an access command to the storage array;
[0012] The target address stripe is determined according to the target namespace and the target virtual logical address.
[0013] In some embodiments, the target address stripe is obtained by dividing it in the following manner:
[0014] Dividing the virtual logical address subspace corresponding to the namespace into a namespace array according to the redundancy mode of the storage array, wherein a row of virtual logical addresses in the namespace array serves as a stripe;
[0015] The virtual logical address subspace is obtained by dividing it in the following way:
[0016] Mapping the storage array into a virtual logical address space according to each of the namespaces;
[0017] The virtual logical address space is divided according to the number of each namespace to obtain virtual logical address subspaces corresponding to each namespace.
[0018] In some embodiments, determining the corresponding cache address space in the cache space management table according to the index of the target address stripe in the access command to the storage array includes:
[0019] Matching the cache address space in the cache space management table according to the index;
[0020] If the match fails, dividing the cache address space from the controller memory for the target address stripe;
[0021] If the match is successful, the index is obtained, and the corresponding cache address space in the cache space management table is obtained.
[0022] In some embodiments, the method further includes: storing the divided cache address space into the cache space management table according to the sequence number of the target address stripe.
[0023] In some embodiments, caching the read and write data determined based on the access command to the storage array into the controller memory according to the cache address space includes:
[0024] If the read / write data is write data, the write data is cached in the controller memory and a command completion message is sent to the remote host.
[0025] In some embodiments, if the read / write data is write data, then after caching the write data in the controller memory, sending command completion information to the remote host includes:
[0026] Performing integrity check on the write data;
[0027] If the verification fails, a prompt message indicating a data write error is sent to the remote host;
[0028] If the verification passes, a command completion message is sent to the remote host.
[0029] In some embodiments, the method further comprises:
[0030] If the access command is a read command, determining the target address stripe to which the virtual logical address segment to be accessed by the read command belongs according to the virtual logical address segment to be accessed;
[0031] Matching a target cache address space in the cache space management table according to the index of the target address stripe;
[0032] If the match is successful, the pre-read data is read from the target cache address space according to the cache address to be accessed by the read command.
[0033] In some embodiments, reading the target data and pre-read data according to the target address stripe and caching them into the controller memory includes:
[0034] Acquire the virtual logical address segment of the target data and the continuous virtual logical address segments adjacent thereto according to the target address stripe;
[0035] The target data and the pre-read data are read from the storage array according to the virtual logical address segment and cached in the controller memory.
[0036] In some embodiments, write data cached in the controller memory is written to the storage array based on data activity.
[0037] In a second aspect, an embodiment of the present application provides a storage array controller, which is applied to a storage array controller, wherein the storage array controller includes a storage interface control module, a redundancy module, a controller memory, and a non-volatile storage control module;
[0038] The redundancy module is respectively connected to the storage interface control module, the non-volatile storage control module and the controller memory;
[0039] The redundancy module is used to implement a storage array data reading and writing method provided in the first aspect of the present application.
[0040] In a third aspect, an embodiment of the present application provides a redundant module device, which is applied to a storage array controller. The storage array controller includes a storage interface control module, a redundant module, a controller memory, and a non-volatile storage control module, including:
[0041] A cache address determination module, configured to determine a corresponding cache address space in a cache space management table according to an index of a target address stripe;
[0042] A data cache module is used to cache read and write data determined based on access commands to the storage array into the controller memory according to the cache address space.
[0043] In a fourth aspect, an embodiment of the present application provides a terminal device, which includes a processor and a memory, the memory storing a computer program, and the processor being used to execute the computer program to implement a storage array data reading and writing method provided in the first aspect of the present application.
[0044] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program. When the computer program is executed on a processor, it implements a storage array data reading and writing method provided in the first aspect of the present application.
[0045] The embodiments of the present application have the following beneficial effects:
[0046] The present application determines the corresponding cache address space in the cache space management table based on the index of the target address stripe; based on the cache address space, the read and write data determined based on the access command to the storage array is cached in the controller memory. The present application divides the virtual logical address subspace corresponding to the namespace into multiple stripes. A cache space management table is constructed based on the stripe index. The physical address assigned to each stripe is recorded in the cache space management table. In this way, it is convenient to manage the cache space of the controller memory, and the cache address space of the target address stripe corresponding to the access command can be quickly found. And by pre-reading a part of the data in the cache space, the data reading and processing time is reduced. Therefore, the embodiment of the present application improves the data processing efficiency of the storage array from multiple aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 A structural block diagram of a storage array controller according to an embodiment of the present application is shown;
[0049] Figure 2 Another structural block diagram of a storage array controller according to an embodiment of the present application is shown;
[0050] Figure 3A flow chart of a method for reading and writing data from a storage array according to an embodiment of the present application is shown;
[0051] Figure 4 A schematic diagram of stripes in a storage array data reading and writing method according to an embodiment of the present application is shown;
[0052] Figure 5 Another flow chart of the storage array data reading and writing method according to an embodiment of the present application is shown;
[0053] Figure 6 Another flow chart of the storage array data reading and writing method according to an embodiment of the present application is shown;
[0054] Figure 7 A schematic structural diagram of a redundant module device according to an embodiment of the present application is shown;
[0055] Figure 8 A schematic diagram of a redundancy group in a cache management method of a storage array according to an embodiment of the present application is shown;
[0056] Figure 9 A schematic diagram of a namespace array in a cache management method for a storage array according to an embodiment of the present application is shown;
[0057] Figure 10 A schematic diagram showing a LBAG to be cleared with all active factor flag bits being 0 in a cache management method for a storage array according to an embodiment of the present application is shown;
[0058] Figure 11 A schematic diagram of a namespace array in a namespace-based cache management method according to an embodiment of the present application is shown;
[0059] Figure 12 A schematic diagram of a namespace group in a namespace-based cache management method according to an embodiment of the present application is shown;
[0060] Figure 13 A schematic diagram of dividing the controller memory in the namespace-based cache management method according to an embodiment of the present application is shown.
[0061] Description of main component symbols:
[0062] 100 - Storage array controller; 200 - Non-volatile storage array; 300 - Remote host; 110 - Storage interface control module; 111 - Message parsing module; 112 - Command queue processing module; 113 - Processor; 120 - Redundancy module; 130 - Non-volatile storage control module; 140 - Controller memory; 150 - Protocol offload engine; 710 - Cache area allocation module; 720 - Data cache module. DETAILED DESCRIPTION
[0063] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0064] The components of the embodiments of the present application generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but rather merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative effort are within the scope of protection of the present application.
[0065] Hereinafter, the terms "including", "having" and their cognates used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the aforementioned items, and should not be understood as excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the aforementioned items or adding the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the aforementioned items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and should not be understood as indicating or implying relative importance.
[0066] Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meaning as in the context of the relevant technical field and will not be interpreted as having an idealized meaning or an overly formal meaning unless clearly defined in the various embodiments of the present application.
[0067] In the prior art, when the CPU acts as the NVMe master, taking data writing as an example, the data writing process performed by the NVMe master is as follows:
[0068] 1) Parse the command sent by the remote host; 2) If the command is a write command, allocate storage space and address for the write command; 3) After being ready to receive data, send the R2T (Ready to Transter) command to the remote host to instruct the remote host to transmit the data to be written; 4) Receive the data to be written and store it in the main control memory according to the allocated storage space; 5) Send the data to be written to the redundant array (RAID / EC) calculation unit to complete the redundancy calculation; 6) Write the data block and check block obtained by the redundancy calculation back to the main control memory; 7) The NVMe memory takes the data block and check block through DMA (Direct Memory Access) to complete the actual disk write of the written data, and sends the CQ (Completion Queque) of the data writing completion to the remote host.
[0069] In existing flash storage array controllers, both read and write data must be processed by a redundant computing unit. To conserve CPU power, separate hardware is typically used to accelerate redundant computations. Data exchange between the redundant computing unit and the main controller memory consumes cache bandwidth, resulting in low data read and write processing efficiency. Furthermore, the read and write data processing flow executed by the NVMe controller also impacts data read and write processing efficiency.
[0070] The following are the keywords involved in the embodiments of this application:
[0071] PCIe: peripheral component interconnect express, a high-speed serial computer expansion bus standard.
[0072] NVMe: non volatile memory express, non-volatile high-speed transmission bus.
[0073] NVMe over Fabric (NVMe-oF) Specification: The NVMe over Fabric (NVMe-oF) specification is a storage network protocol. Currently, NVMe-oF-based storage devices typically use a multi-node architecture (a node can also be considered a controller) to enable host access to storage devices, improving the reliability and continuity of storage services. The NVMe over Fabric (NVMe-oF) specification is a high-speed storage protocol built on the NVMe protocol. NVMeoF is used to access NVMe storage media across networks. NVMe-oF adds fabric-related commands to NVMe, extending NVMe's application scenarios beyond the scope of a single device to include cross-network communication. "Fabric" refers to the network between the host and the storage media. Typical fabric types include Ethernet, Fibre Channel, InfiniBand (IB), and Direct Memory Access (RDMA).
[0074] SSD: Solid State Drive.
[0075] HBM: High Bandwidth Memory.
[0076] The storage array in the present application includes a non-volatile storage array, and the embodiments of the present application are described based on the non-volatile storage array as an example.
[0077] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments may be combined with each other.
[0078] Figure 1 FIG. 1 is a block diagram of a storage array controller according to an embodiment of the present application. Exemplarily, the storage array controller 100 includes: a storage interface control module 110 , a redundancy module 120 , a non-volatile storage control module 130 , and a controller memory 140 .
[0079] The redundancy module 120 is respectively connected to the storage interface control module 110, the non-volatile storage control module 130 and the controller memory 140. The controller memory 140 may adopt HBM.
[0080] The storage interface control module 110 is in communication with the remote host 300 , and is configured to receive and parse message data sent by the remote host 300 to obtain operation commands, schedule and manage the operation commands based on the namespace, and transmit the commands to the redundancy module 120 .
[0081] Further, if Figure 2 As shown, the storage array controller 100 further includes a protocol offload engine 150 , and the storage interface control module 110 includes a processor 113 , a message parsing module 111 and a command queue processing module 112 .
[0082] The protocol offload engine 150 is configured to receive a protocol message of a preset protocol type sent by the remote host 300 , parse the protocol message, and send the message data obtained by parsing to the message parsing module 111 in the storage interface control module 110 .
[0083] The processor 113 is connected to both the message parsing module 111 and the command queue processing module 112 .
[0084] The message parsing module 111 is used to receive and parse the message data sent by the remote host 300, obtain operation commands, and send data transmission type operation commands to the command queue processing module 112, and send non-data transmission type operation commands to the processor 113.
[0085] The processor 113 is configured to establish a connection with the remote host 300 according to the operation command, and to configure and manage the scheduling function parameters of the command queue processing module 112 .
[0086] The command queue processing module 112 is configured to store the operation command into a corresponding namespace command queue according to the accessed target namespace for scheduling management, and transmit the operation command to the redundancy module 120 in sequence.
[0087] The redundancy module 120 is configured to perform redundancy calculation on the data and then write the data into the controller memory 140 , and to manage the logical address space of the non-volatile storage array 200 and the controller memory 140 based on the namespace.
[0088] The non-volatile storage control module 130 is in communication with the non-volatile storage array 200 and, in response to a data transfer request from the redundancy module 120, maps the controller memory 140 to implement data exchange with the non-volatile storage array 200. The non-volatile storage control module 130 interacts with the non-volatile storage array 200 to read or write data via DMA (Direct Memory Access).
[0089] For example, the storage array controller 100 of an embodiment of the present application is described using a write command as an example. In this example, the storage interface control module uses an NVMe-oF controller, the non-volatile storage control module 130 uses an NVMe-PCIe host, the protocol offload engine 150 uses a TOE module (TCP / IP Offload Engine), and the controller memory 140 uses HBM. The specific processing process of the storage array controller 100 includes the following steps:
[0090] S111: The TOE module receives a protocol message of a preset protocol type sent by the remote host 300, parses the protocol message, and sends the message data obtained by parsing to the NVMe-oF controller. The protocol message of the preset protocol type may be a TCP / IP / Ethernet message, and the message data may be the data portion of the TCP / IP / Ethernet message.
[0091] S112: The message parsing module 111 in the NVMe-oF controller receives and parses the message data sent by the remote host 300, obtains an operation command, and sends the data transmission type operation command to the IOQ processing module. The operation command includes a PDU (Protocol Data Unit), and the operation command is determined to be a data transmission type based on the PDU, that is, the operation command is a write operation command.
[0092] S113: The IOQ processing module stores the write operation command in the corresponding namespace command queue based on the target namespace being accessed for scheduling and management, and sequentially transmits the write operation command to the redundancy module 120. Alternatively, the write operation command may be added to a read / write command queue, a priority command queue, or other queues. When the IOQ processing module receives a write operation command to write data, it sends an indication command to the redundancy module 120, instructing it to prepare an idle first cache subspace to receive the data to be written.
[0093] S114 , the redundancy module 120 queries the cache status table to determine whether there is sufficient cache space in the controller memory 140 to receive the data to be written.
[0094] Redundancy module 120 determines whether controller memory 140 has address space for the corresponding LBA block. If so, but the LBA block is in an uncompleted state from a previous command, redundancy module 120 suspends processing of the write command until the corresponding LBA block is unlocked. If controller memory 140 does not have address space for the corresponding LBA block, redundancy module 120 requests an idle first cache subspace. If controller memory 140 has address space for the corresponding LBA block, the LBA block is unlocked, and there is sufficient space for writing the command data, redundancy module 120 responds with an R2T command to remote host 300, instructing remote host 300 to send the data to be written.
[0095] If there is not enough cache space, the data in the corresponding namespace will be actively written to disk to free up cache space.
[0096] S115, after receiving the R2T command, the remote host 300 sends the data to be written in the form of a TCP / IP / Ethernet message, which is then parsed by the TOE module and the message parsing module 111 and sent to the redundancy module 120 via the IOQ processing module.
[0097] S116 , the redundancy module 120 divides the data blocks and calculates the check blocks according to the current redundancy mode of the non-volatile storage array 200 .
[0098] First, the redundancy module 120 needs to perform a data integrity check on the data to be written, and check whether the data is consistent based on the DIF (Data Integrity Field) of the data.
[0099] After the integrity check is passed, redundancy calculation is performed. If the current redundancy mode is k+m, the data is divided into k parts, and m parts of verification data are obtained based on the encoding of the k parts of data. The k+m parts of data obtained after the redundancy calculation are written into the controller memory 140.
[0100] The CQ (Completion Queque) corresponding to the data write completion is sent to the remote host 300 to notify the remote host 300 that the data write is complete. Since the redundancy module 120 has completed the data integrity check, ensuring the reliability of the data to be written in the cache, the remote host 300 can be directly notified that the data write is complete without waiting for the data to be actually written to the non-volatile storage array 200 (NVME hard drive). If an integrity check error occurs on the non-volatile storage array 200 side during the subsequent disk write process, the data can be read again from the controller memory 140.
[0101] S117, the redundancy module 120 generates a disk write command to inform the NVMe-PCIe host of the cache address of k+m copies of data (data to be written and verification data after redundancy calculation).
[0102] S118, the NVMe-PCIe host maps the corresponding first cache subspace to the memory of the NVME-PCIe host.
[0103] For example, the cache address of k+m copies of data is A1-A5. The NVME-PCIe host writes the first address A1 and the data length into the DMA register of the corresponding namespace in the NVMe hard disk. Each namespace corresponds to a register. The register address is exchanged when the NVMe-PCIe host and the NVME hard disk initialize and establish a DMA connection.
[0104] When a DMA register in the NVMe hard drive is enabled, the NVMe hard drive can directly read k+m copies of data from the cache mapped by the corresponding NVMe-PCIe host by writing the first address A1 and data length of the register through the NVMe-PCIe host.
[0105] After the data is read, the NVMe hard drive writes the DMA completion flag into the DMA register of the NVMe-PCIe host.
[0106] S119, the NVMe-PCIe host sends a disk write completion notification in response to the DMA completion to notify the redundancy module 120 that the cache space A1-A5 has been released, and the cache space can be continued to be used by the redundancy module 120.
[0107] By way of example, the storage array controller 100 of the embodiment of the present application is introduced below based on a read command as an example. The specific processing process of the storage array controller 100 includes the following steps:
[0108] S121, the TOE module parses the received TCP / IP / Ethernet message and sends the parsed message data (data part) to the NVMe-oF controller.
[0109] S122, the message parsing module 111 in the NVMe-oF controller decapsulates the message data to obtain an operation command, which includes a PDU (Protocol Data Unit). According to the PDU, the operation command is determined to be a data transmission type (read operation command), and then the read operation command is sent to the IOQ processing module (command queue processing module 112).
[0110] S123, the IOQ processing module adds the received read operation command to a command queue for management and scheduling, such as a read / write command queue, a priority command queue, or an NS (NameSpace) command queue.
[0111] When the read operation command is executed, an indication command is sent to the redundant module 120 to instruct the redundant module 120 to check whether there is an address space of the corresponding LBA block in the controller memory 140. If so, and it is not in a locked state, the data is read directly from the address space of the corresponding LBA block in the controller memory 140; if so, and the corresponding LBA block is in a locked state, the execution of the command is temporarily suspended; if there is no address space of the corresponding LBA block in the controller memory 140, the second cache subspace is prepared and the relevant data is read.
[0112] At the same time, the IOQ processing module generates a command for reading consecutive addresses in the same namespace and transmits it to the redundancy module 120 .
[0113] S124, the redundancy module 120 queries the cache status table to see if there is enough cache space to receive the data to be read. If so, it instructs the NVMe-PCIe host to read the data from the NVMe hard disk, and informs the address of the second cache subspace for receiving the data and the target address of the data to be read.
[0114] If there is not enough cache space, the data in the corresponding namespace will be sent to the remote host 300 first to free up cache space.
[0115] S125, the NVMe-PCIe host sends a data read command to the NVMe hard disk, and maps the cache space to the memory of the NVMe-PCIe host to receive the data to be read.
[0116] S126, after the NVMe hard disk prepares the data to be read, it writes the first address and length of the data into the DMA register of the NVMe-PCIe host.
[0117] S127, the NVMe-PCIe host responds to the DMA register enable, directly reads data from the memory of the NVMe hard disk according to the data address and data length written by the NVMe hard disk, and notifies the redundancy module 120 to release the relevant cache after reading.
[0118] S128 , the redundancy module 120 merges the data blocks or recovers the data according to the redundancy mode of the current array, and sends the data to the remote host 300 .
[0119] To increase the speed of data read and write processing for the non-volatile storage array 200, for example, to increase the speed of determining the first cache subspace and the second cache subspace in the controller memory 140, the present application further provides a storage array data read and write method. The redundancy module 120 in the present application implements the storage array data read and write method of the present application.
[0120] The storage array data reading and writing method is described below with reference to some specific embodiments.
[0121] Figure 3 A flowchart of a method for reading and writing data in a storage array according to an embodiment of the present application is shown. In the embodiment of the present application, the redundancy module 120 performs cache management on the controller memory 140 (hereinafter referred to as cache) according to the current redundancy mode and the number of NS (Namespace). Exemplarily, the method for reading and writing data in a storage array includes the following steps:
[0122] S210 , determining a corresponding cache address space in a cache space management table according to an index of a target address stripe in an access command to a non-volatile storage array.
[0123] Furthermore, in the embodiment of the present application, the non-volatile storage array 200 is mapped into a virtual logical address space based on each namespace. For each logical address in the non-volatile storage array 200, there is a unique virtual logical address (Vir_LBA) corresponding to it in the virtual logical address space. The virtual logical address is used to determine the logical address in the non-volatile storage array 200 to be accessed.
[0124] The virtual logical address space is divided according to the number of each namespace to obtain virtual logical address subspaces corresponding to each namespace one by one. Thus, the virtual logical address subspaces are obtained by division, as shown in Table 1.
[0125] Table 1 Correspondence between namespace and virtual logical address subspace
[0126] Namespace Virtual logical address subspace NameSpace 1 VIR_LBA0-VIR_LBA99 NameSpace 1 VIR_LBA100-VIR_LBA249 … … NameSpace x VIR_LBAm-VIR_LBAn
[0127] Furthermore, in order to improve performance and facilitate management, the virtual logical address subspace corresponding to the namespace is divided into a namespace array according to the redundancy mode of the non-volatile storage array 200. A row of virtual logical addresses in the namespace array is regarded as a stripe, thereby obtaining the target address stripe. That is, the allocation granularity of the VIR_LBA in the NS is set according to the redundancy mode of the SSD hard disk (the SSD hard disk in the non-volatile storage array 200), and the VIR_LBA in the NS is divided into LBA stripes according to the number of members in the redundancy group of the SSD hard disk, such as Figure 4 shown.
[0128] Furthermore, determining the corresponding cache address space in the cache space management table according to the index of the target address stripe includes:
[0129] S211: Determine a target namespace and a target virtual logical address to be accessed according to an access command to the non-volatile storage array 200. The access command includes the target namespace and the target virtual logical address.
[0130] S212: Determine the target address stripe according to the target namespace and the target virtual logical address.
[0131] In one embodiment, determining the corresponding cache address space in the cache space management table according to the index of the target address stripe includes:
[0132] Matching the cache address space in the cache space management table according to the index;
[0133] If the match fails, the cache address space is obtained by partitioning the target address stripe from the controller memory 140 ;
[0134] If the match is successful, the index is obtained, and the corresponding cache address space in the cache space management table is obtained.
[0135] Furthermore, to facilitate cache space management, in an embodiment of the present application, a cache space management table is established based on the stripe index. It is understood that the method further includes: storing the divided cache address space in the cache space management table based on the sequence number of the target address stripe. After allocating cache space (cache address space) from the controller memory 140 for a stripe, the address of the cache space is written into the cache space management table. As shown in Table 2, the cache space management table records the physical address (Physics Block Address, PBA) of the controller memory 140 corresponding to each stripe.
[0136] Table 2 Cache space management table
[0137]
[0138] When a cache search is needed, the index of the stripe mapped to the virtual logical address corresponding to the access command is first determined. Then, based on the stripe index, the cache space management table is checked to see if cache space is allocated for that stripe. This application uses NS as the management unit, the index of the stripe where the virtual logical address is located as the KEY, and the Value of each physical address bit allocated to the stripe to construct a key-value pair. When read or write commands need to search for data stored in the cache space, they can quickly hit the target.
[0139] S220 , cache the read and write data determined based on the access command to the non-volatile storage array 200 in the controller memory 140 according to the cache address space.
[0140] When any VIR_LBA within a stripe is used, the virtual logical address of the entire stripe in which the VIR_LBA is located is allocated, and cache space for the entire stripe is requested. For example, if a write data command for NS1 is received with a data length of 5, virtual logical addresses VIR_LBA0-VIR_LBA4 are assigned. Since VIR_LBAs are allocated and managed on a stripe-by-strip basis, stripe 1 is assigned to the current write data command, and sufficient cache space is requested from controller memory 140 for this stripe to cache the incoming write data. The received write data is cached in the cache space corresponding to LBA0-LBA4.
[0141] S230: If the access command is a read command, read the target data and pre-read data according to the target address stripe and cache them in the controller memory.
[0142] In one embodiment, in order to significantly reduce the latency of read commands, the present application supports pre-reading data. It can be understood that the cache address space is used to cache the read and write data determined based on the access command to the non-volatile storage array 200 to the controller memory 140, including:
[0143] If the access command is a read command, obtaining the virtual logical address segment of the target data and the continuous virtual logical address segments adjacent thereto according to the target address stripe;
[0144] Target data and pre-read data are read from the non-volatile storage array 200 according to the virtual logical address segment and cached into the controller memory.
[0145] S240: Send the target data.
[0146] The target data requested by the read command is sent to the host, and then the target data and the pre-read data are retained in the controller memory 140 so as to be directly read from the controller memory 140 by subsequent access commands related to the virtual logical address segment.
[0147] For example, when a read command is received, a command to read the relevant continuous addresses is generated based on the target access address of the read command and passed to the redundancy module 120 (EC / RAID). The redundancy module 120 reads data from the non-volatile storage array 200 based on the relevant continuous addresses and caches the read data in the controller memory. When the IOQ processor 113 subsequently receives a command to access the relevant continuous addresses, it can quickly retrieve the above data from the controller memory, thereby significantly reducing the latency of the read command.
[0148] In one embodiment, the method further comprises:
[0149] If the access command is a read command, determining the target address stripe to which the virtual logical address segment to be accessed by the read command belongs according to the virtual logical address segment to be accessed;
[0150] Matching a target cache address space in the cache space management table according to the index of the target address stripe;
[0151] If the match is successful, the pre-read data is read from the target cache address space according to the cache address to be accessed by the read command.
[0152] In one embodiment, the embodiment of the present application not only supports write termination, significantly reducing write latency, but also can identify the activity level of data in the controller memory to reduce wear and tear on the SSD hard disk. It can be understood that the method also includes: writing the write data cached in the controller memory 140 to the non-volatile storage array 200 based on the activity level of the data. Under the premise of the write termination mechanism, the present application enables the redundancy module 120 to identify the activity level of data in the controller memory, temporarily store active data in the cache space, and not write it to the disk. When there is a subsequent related write command to update the data, it can be completed directly in the cache space, reducing wear and tear on the SSD hard disk.
[0153] In one embodiment, the present application supports a write summary function. After the redundancy module 120 writes the data corresponding to the write command to the controller memory 140 managed by the redundancy module 120, a command completion message CQ can be sent to the remote host 300 without waiting for the data to be actually written to the SSD disk, thereby significantly reducing write latency. It can be understood that in step S220, the read and write data determined based on the access command to the non-volatile storage array 200 is cached in the controller memory 140 according to the cache address space, including:
[0154] If the read / write data is write data, the write data is cached in the controller memory 140 and then command completion information is sent to the remote host 300 .
[0155] Furthermore, if the read / write data is write data, after caching the write data in the controller memory 140 , a command completion message is sent to the remote host 300 , including:
[0156] An integrity check is performed on the write data.
[0157] If the verification fails, a prompt message indicating a data write error is sent to the remote host 300;
[0158] If the verification passes, a command completion message is sent to the remote host 300.
[0159] The following describes the storage array data reading and writing method of the present application embodiment with reference to an example of a write command. Figure 5 As shown, the specific steps include:
[0160] S301: The redundancy module 120 receives a write command and determines the stripe to which it is mapped based on the namespace and target virtual logical address accessed by the current write command.
[0161] S302: Based on the stripe's index, the established cache space management table is checked to see if the stripe is in the cache. If the stripe is in the cache, it indicates that a cache address space (e.g., PBAx-PBAy) has been allocated for the stripe, and step S304 is executed. If not, it indicates that no cache address space has been allocated for the stripe, and step S303 is executed.
[0162] S303 : Apply for a cache address space in the controller memory 140 for the stripe, for example, PBAx-PBAy.
[0163] S304: Send R2T (Ready to Transfer, indicating that the cache address space is ready) to the host to instruct the remote host 300 to send the data to be written.
[0164] S305, the redundancy module 120 performs integrity check on the data to be written. If the check fails, a CQ with an error message is sent to the remote host 300; if the check passes, a CQ with a completion status (corresponding to command completion information) is sent and step S306 is executed.
[0165] S306: Store the integrity-verified data to be written into the allocated cache address space.
[0166] The following describes the storage array data reading and writing method according to the embodiment of the present application with reference to an example of a read command. Figure 6 As shown, the specific steps include:
[0167] S401 : The redundancy module 120 receives a read command and determines the mapped stripe according to the namespace and target virtual logical address accessed by the current read command.
[0168] S402: Check the cache space management table for the stripe in the cache based on the stripe index. If the stripe is in the cache, execute step S404; if not, execute step S403.
[0169] S403 , applying for a cache address space, such as PBAm-PBAn, in the controller memory 140 for the stripe.
[0170] S404, determining whether the physical address corresponding to the virtual logical address of the stripe is used; if it is used, it indicates that pre-read data already exists, and the pre-read data in the physical address cache is directly read and the pre-read data is used as the read data.
[0171] If it is not in use, a pre-read command is initiated to the SSD hard disk to read the data corresponding to the entire stripe, and the pre-read data read is stored in the allocated cache address space.
[0172] S405 , returning the read data in the physical address corresponding to the target virtual logical address to the remote host 300 .
[0173] The present application divides the virtual logical address subspace corresponding to NS into multiple stripes. A cache space management table is constructed based on the stripe index. The physical address allocated to each stripe is recorded in the cache space management table. In this way, it is convenient to manage the cache space of the controller memory 140, and the cache space corresponding to the access command can be quickly found. At the same time, the present application example also provides a write summary function, which can greatly reduce the write latency. Finally, based on the write termination function, the present application also supports pre-reading data, thereby greatly reducing the latency of the read command. Therefore, the embodiment of the present application improves the data processing efficiency of the non-volatile storage array from multiple aspects.
[0174] Figure 7 FIG. 7 is a schematic diagram showing a structure of a redundant module device according to an embodiment of the present application. Exemplarily, the redundant module device includes: a cache area allocation module 710 and a data cache module 720 .
[0175] The cache area allocation module 710 is configured to allocate a cache area to an access command in a static cache subspace according to a namespace to be accessed by the access command.
[0176] The data cache module 720 is configured to receive target data for reading and writing the storage array based on the access command, and cache the target data in the cache area.
[0177] The static cache subspace is obtained by dividing the static cache space in the controller memory 140 according to the namespace.
[0178] It can be understood that the device of this embodiment corresponds to the storage array data reading and writing method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described again here.
[0179] In order to improve the efficiency of the redundancy module in processing data on the controller memory 140 based on the namespace, an embodiment of the present application further provides a cache management method for a storage array. In an embodiment of the present application, the redundancy module implements a cache management method for a storage array provided by the present application.
[0180] The cache management method of the storage array is described below with reference to some specific embodiments.
[0181] In the embodiment of the present application, the redundancy module 120 performs cache management on the controller memory 140 (hereinafter referred to as cache) according to the current redundancy mode and the number of NS (Namespace). Exemplarily, the cache management method of the storage array includes the following steps:
[0182] S2210, map the non-volatile storage array 200 to a virtual logical address space according to the namespace, and divide the virtual logical address space into virtual logical address groups. Map the logical addresses of the non-volatile storage array 200 one by one to obtain a virtual logical address space, which includes virtual logical addresses (also known as VIR_LBA addresses) corresponding to all logical addresses (also known as LBA addresses, logical block addresses, Logical Block Address) in the non-volatile storage array 200. There is a mapping relationship between the VIR_LBA address in the embodiment of the present application and the LBA address of the non-volatile storage array 200, and the relationship between the LBA address and the PBA address (Physics Block Address) in the non-volatile storage array 200 is processed by the controller in the non-volatile storage array 200 after the disk is written, and is not limited in comparison with the present application. The storage array controller 100 of the present application is an external controller of the non-volatile storage array 200.
[0183] In one embodiment, the present application supports HMB (Host Memory Buffer) technology, where the memory of the storage array controller 100 is open to the controller of the non-volatile storage array 200 to store the FTL (Flash Translation Layer) table. When the non-volatile storage array 200 is a DRAMless hard drive, enabling this function can significantly improve the performance of the storage array.
[0184] Furthermore, dividing the virtual logical address space into virtual logical address groups includes:
[0185] The virtual logical address space is divided according to a preset number of namespaces to obtain virtual logical address subspaces of a number equal to the preset number.
[0186] That is, the redundancy module 120 allocates a fixed VIR_LBA address space (virtual logical address subspace) to each namespace, as shown in Table 2-1.
[0187] Table 2-1 Namespace and VIR_LBA address space
[0188] Namespace VIR_LBA address NameSpace1 VIR_LBA0-VIR_LBA99 NameSpace2 VIR_LBA100-VIR_LBA249 … … NameSpacex VIR_LBAm-VIR_LBAn
[0189] A fixed mapping is established between each VIR_LBA address in each namespace and the LBA address of the non-volatile storage array 200. As shown in Table 2-2, the LBA addresses of NS1 in the non-volatile storage array 200 are LBA1050-LBA1149.
[0190] Table 2-2 Mapping relationship between VIR_LBA address and LBA address in non-volatile storage array
[0191]
[0192]
[0193] For example, when a write data command for NS1 is received, the write data size is 10, and a virtual logical address of VIR_LBA0-VIR_LBA9 is assigned to the write data command, and sufficient cache space is requested from the controller memory 140 (e.g., HBM High Bandwidth Memory) for VIR_LBA0-VIR_LBA9 to prepare for receiving the write data. VIR_LBA0-VIR_LBA9 is mapped to the logical addresses LBA1050-LBA1059 of the non-volatile storage array 200 (e.g., SSD hard disk). Furthermore, each continuous logical address block in the virtual logical address subspace is divided into a namespace array according to the redundancy mode of the non-volatile storage array 200; a row of the logical address blocks in the namespace array is regarded as a stripe, wherein the number of logical address blocks in the stripe is the same as the number of redundant group members in the non-volatile storage array 200, and the namespace array is divided into multiple virtual logical address groups, each of which includes one or more stripes.
[0194] If the current redundancy mode is k+m, that is, there are k+m i members in a redundancy group, such as Figure 8 As shown, SSD1-SSDi is a redundant group.
[0195] To improve performance, this embodiment of the application divides the namespace array into multiple virtual logical address groups. Specifically, the contiguous VIR_LBA address space within a namespace is defined as a VIR_LBA group, denoted as a VIR_LBAG. When the array is redundant, each VIR_LBAG is further divided into arrays based on the current redundancy mode.
[0196] Divide the cache array according to the current redundancy mode Figure 9 (A namespace array divided by a virtual logical address group in a namespace under a redundancy group), each row in the NS array (namespace array) is a stripe, and the number of LBA_BLOCKs (logical address blocks) in the stripe is determined by the number of redundant group members. The VIR_LBA address of the namespace corresponds one-to-one to the LBA address of the SSD disk. The number of LBA_BLOCK blocks in each column is related to the total VIR_LBA capacity allocated to the current NS, the overall cache capacity, and the actual storage business characteristics. For example, a certain NS may be mainly small random IO, then the number of LBA_BLOCK blocks in the array can be designed to be very small, and the same cache space can be divided into more VIR_LBAGs. For devices that support redundancy features, the VIR_LBAG in its cache is at least one stripe ( Figure 9 In other cases, multiple stripes can be divided into one VIR_LBAG for management and operation as needed.
[0197] The space size of a VIR_LBAG and the number of LBA_BLOCKs remain unchanged when the redundancy group configuration remains unchanged. This also applies if individual members of the redundancy group fail (for example, an SSD member is damaged and cannot be used, but the entire redundancy group can still recover data normally).
[0198] S2220: Determine the activity level of cached data in the virtual logical address group according to the storage status corresponding to the virtual logical address group.
[0199] S2230: Determine a target virtual logical address group that needs to be stored in the non-volatile storage array 200 according to the activity level.
[0200] In order to ensure that there is enough free space in the cache space, the present application writes data with low activity levels to the disk. It can be understood that the target virtual logical address group that needs to be stored in the non-volatile storage array 200 according to the activity level includes:
[0201] The virtual logical address group with a low activity level is determined as the target virtual logical address group.
[0202] When the cache space is full, the virtual logical address group at the intermediate activity level may also be determined as the target virtual logical address group.
[0203] Furthermore, the determining of the target virtual logical address group to be stored in the non-volatile storage array 200 according to the activity level includes:
[0204] The target cache data that needs to be stored in the non-volatile storage array 200 in the target virtual logical address group is determined according to the storage status.
[0205] Furthermore, the determining of the target virtual logical address group to be stored in the non-volatile storage array 200 according to the activity level includes:
[0206] The target logical address for storing the target cache data in the non-volatile storage array 200 is determined according to the virtual logical address group and the preset logical address mapping relationship.
[0207] The target cache data is written into the non-volatile storage array 200 according to the target logical address.
[0208] In one embodiment, the storage status includes a read / write status flag corresponding one-to-one to each logical address block in the virtual logical address group.
[0209] Exemplarily, in an embodiment of the present application, an LBAG status table (also known as a virtual logical address group status table) is used to record the allocation and usage of VIR_LBAG in each namespace. That is, the storage status is stored in the LBAG status table. The activity level of the cached data in the virtual logical address group is determined based on the storage status recorded in the LBAG status table. The LBAG status table includes read-write status flags that correspond one-to-one to each logical address block (LBA_BLOCK) in the virtual logical address group. Multiple read-write status flags are required depending on the number of LBA_BLOCKs in the current virtual logical address group, and each LBA_BLOCK corresponds to a 1-bit read-write status flag, as shown in Table 2-3.
[0210] Table 2-3LBAG status table 1
[0211]
[0212] The step of determining target cache data in the target virtual logical address group that needs to be stored in the non-volatile storage array 200 according to the storage state includes:
[0213] The cached data in the logical address block corresponding to the read / write status flag in the target virtual logical address group is determined as the target cached data. That is, within the target virtual logical address group, the logical address block corresponding to the read / write status flag in the write state is first determined to obtain the target logical address block, and the cached data in the target logical address block is determined as the target cached data. The target cached data is stored in the non-volatile storage array 200 to complete the write to disk.
[0214] Furthermore, the method further includes: updating the corresponding storage status according to the read and write operations on the virtual logical address groups corresponding to the namespaces in the cache, specifically including:
[0215] If the data stored in the cache of the logical address block is first data, the read / write status flag corresponding to the logical address block is set to the write state, and the first data is the write data sent by the remote host 300. For example, if the data in the logical address block is write data from the NVMe-oF controller, the read / write status flag corresponding to the logical address block is set to 1, indicating the write state. Therefore, when the current virtual logical address group needs to be written to disk, the data corresponding to the logical address block with the read / write status flag set to 1 must be written to disk.
[0216] If the data stored in the cache of the logical address block is second data, the read / write status flag corresponding to the logical address block is set to the read state; the second data is empty data or read data read from the non-volatile storage array 200. For example, if the data in the logical address block is read data from the SSD, or if no data is currently written to the logical address block, the read / write status flag corresponding to the logical address block is set to 0, indicating a read state. Therefore, when the current virtual logical address group needs to be written to disk, the data in the logical address blocks set to 0 is not written to disk.
[0217] Furthermore, the method further comprises:
[0218] When writing the target cache data into the non-volatile storage array 200, redundancy calculation is performed on the cache data in each logical address block in the stripe to obtain verification data and write it into the verification block in the stripe; and the read-write status flag corresponding to the verification block is set to the write state.
[0219] In redundancy mode, when the IOQ processing module transmits write data to the redundancy module 120, it only divides the write data according to the current redundancy mode and stores it in the corresponding data block cache. No verification calculation is performed temporarily, and the corresponding check block is empty. The verification data is calculated and filled into the corresponding check block when it needs to be written to the disk. The read-write status flag corresponding to the check block used to store the check data will be forced to 1 to indicate that the LBA_BLOCK needs to be written to the disk. For example, if the current redundancy mode is k+m, then the write data is written to the k data LBA_BLOCKs in a stripe, and the read-write status flag is set to 1. Although the m check blocks are temporarily empty and the check data does not come from the NVMe-oF controller, the check data will be calculated when it needs to be written to the disk, and the check blocks will be written and the corresponding read-write status flag will be set to 1, indicating that the LBA_BLOCK needs to be written to the disk.
[0220] In one embodiment, the storage status includes a full flag corresponding to each virtual logical address group. One virtual logical address group corresponds to one full flag, and one full flag is stored using 1 bit.
[0221] The method further comprises:
[0222] Determine whether each read / write status flag corresponding to each logical address block in the virtual logical address group is in the write state, and obtain the number of logical address blocks whose read / write status flag is in the write state. If the number of blocks is greater than a preset threshold, determine that the full flag corresponding to the virtual logical address group is in the full state. For example, in the write state, the full flag is set to 1, indicating that the cache space corresponding to the virtual logical address group is full or about to be full.
[0223] The method further includes: using the virtual logical address group corresponding to the full state of the write flag as the target virtual logical address group, that is, the virtual logical address group that needs to be written to the disk, and then determining the target cache data that needs to be written to the disk according to the read-write status identification bit.
[0224] Exemplarily, the number of 1s in each read / write status flag within a virtual logical address group is counted. When this number exceeds a preset threshold (e.g., 2 / 3 of the logical address block), the full flag is set to 1 to indicate that the virtual logical address group is full, as a condition for flushing to disk. In one embodiment, the storage status includes a number of activity factor flags corresponding to each virtual logical address group. Each virtual logical address group corresponds to one activity factor flag, and the activity factor flag has a size of 1 to n bits.
[0225] The method further includes: updating corresponding storage states according to read and write operation commands of the virtual logical address groups corresponding to each namespace in the cache, specifically including:
[0226] The activity factor flag value corresponding to the virtual logical address group is set according to the frequency of the read and write operation commands received for the virtual logical address group. The greater the frequency of the read and write operations, the more active the virtual logical address group is.
[0227] Furthermore, setting the corresponding activity factor flag value according to the frequency of the read and write operation commands received by the virtual logical address group includes:
[0228] Counting objects based on the virtual logical address group according to a preset frequency and counting period;
[0229] During the counting period, the activity factor flag value is updated according to a preset updating rule based on whether the virtual logical address group receives a read or write operation command.
[0230] Furthermore, the activity factor flag value is updated according to a preset update rule based on whether the virtual logical address group receives a read or write operation command within the counting period, including:
[0231] If the read / write operation command is not received within the counting period, the respective digits of the activity factor flag value are retrieved in a set digit order, and the second state value is updated and written to the digit corresponding to the first first state value; wherein, in the initial state, the values of the respective digits of the activity factor flag value are all the first state values.
[0232] If the read / write operation command is received within the counting cycle, the respective digits of the activity factor flag value are retrieved in the reverse order of the set digits, and the first state value is updated and written to the digit corresponding to the first second state value.
[0233] For example, once a virtual logical address group is allocated, the activity factor flag value of the activity factor flag bit defaults to all 1s. Whether the individual bits in the activity factor flag value are set to 0 depends on a counter that continuously accumulates naturally, and the operating frequency of the counter (i.e., the speed of counting) can be set. A certain technical cycle is set based on the counter. If no read or write operation is received for the current virtual logical address group when the counter overflows, one of the bits of the activity factor flag value is set to 0; if a read or write operation is received for the current virtual logical address group within one counting cycle of the counter, the counter is reset to zero and the count is restarted, and a 0-bit bit of the activity factor flag value is flipped to 1.
[0234] For example, if a 3-bit liveness factor flag is set, and the counter's counting period is t, the counter will naturally increment from 0. After counting period t, the counter reaches its maximum value and overflows. After the current virtual logical address group is allocated, the liveness factor flag value is 111, and the counter begins counting. If no read / write operation is received for the current virtual logical address group after counting period t, the liveness factor rolls over to 110. The counter resets to zero and counts again. If no read / write operation is received for the current virtual logical address group after counting period t, the liveness factor flag value rolls over to 100. If the counter resets to zero and counts again but receives a read / write operation for the current virtual logical address group before the end of the counting period, the liveness factor flag value rolls over to 110, and so on. That is, if the liveness factor flag value receives a read or write command within the counting period, the value of the 0 digit rolls over to 1, and so on. When the liveness factor flag value is all 1, there is no overflow and it remains all 1. If no read or write operation command is received during the counting cycle, the value of the 1 digit is flipped to 0, and so on; when the activity factor flag value is all 0, it does not overflow and remains all 0.
[0235] Furthermore, determining the activity level of cached data in the virtual logical address group according to the storage state corresponding to the virtual logical address group includes:
[0236] If the numbers on each digit of the activity factor flag value corresponding to the virtual logical address group are all the second state values, the activity level of the cached data in the virtual logical address group is determined to be a low activity level.
[0237] If the numbers on each digit of the activity factor flag value corresponding to the virtual logical address group are all the first state values, the activity level of the cache data in the virtual logical address group is determined to be a high activity level.
[0238] Counting the number of digits of each digit of the activity factor flag value that are the first state value;
[0239] If the number of digits is greater than a preset number, the activity level of the cached data in the virtual logical address group is determined to be an intermediate activity level.
[0240] The activity factor flag value represents the activity of the virtual logical address group, that is, the hotness or coldness of the data. A larger activity factor flag value indicates a more active virtual logical address group. Active data is kept in the cache as much as possible. An activity factor flag value of all 0 indicates that the virtual logical address group is no longer active and requires a write command to the SSD. If cache space is insufficient, cached data in virtual logical address groups with intermediate activity (non-all 0 values) can be written to disk based on activity.
[0241] In this embodiment, an activity factor flag value is used to represent the activity level of the data in the current virtual logical address group. Retaining highly active data in the cache reduces frequent operations on the SSD after the active data is written to disk, thereby reducing wear on the SSD and extending its lifespan. This also reduces the bandwidth requirements of the backend PCIe channel, significantly improving the I / O command performance of active data.
[0242] In one embodiment, the virtual logical address group is the granularity of read and write operation commands.
[0243] The storage state includes a number of lock flag bits equal to the number of virtual logical address groups. One virtual logical address group corresponds to one lock flag bit, for example, the size of the lock flag bit is 1 bit.
[0244] The method further comprises:
[0245] When operating the current virtual logical address group according to the read / write operation command, the lock flag corresponding to the current virtual logical address group is set to a locked state; and the read / write operation command accessing the virtual logical address group in the locked state is delayed. That is, after a read / write operation command operates the current virtual logical address group, the virtual logical address group is in a locked state before the read / write operation command is completed. For example, the lock flag is set to 1 to indicate a locked state. When a subsequent read / write operation command accessing the virtual logical address group in the locked state is received, the subsequent read / write operation command is delayed to prevent the two previous read / write operation commands from conflicting with each other, thereby causing confusion in the data of the virtual logical address group.
[0246] Each read or write command operates at the virtual logical address group granularity. Even if the currently requested cache space only covers one logical address block within a virtual logical address group, the entire virtual logical address group is locked until the current command completes. Only then can the next read or write command targeting the current virtual logical address group be executed. This reduces I / O execution speed somewhat, but it reduces repeated and frequent redundant calculations and wear and tear on the SSD.
[0247] The following is an example to introduce the cache management method of the storage array of the embodiment of the present application. In this example, the storage status includes a read-write status flag, a full flag, an activity factor flag and a lock flag, as shown in Table 2-4.
[0248] Table 2-4LBAG status table 2
[0249]
[0250] The activity factor flag bits of the current virtual logical address group are all 0, indicating that the current virtual logical address group has been inactive for a long time and needs to be cleared. The specific steps include:
[0251] S2301: The redundancy module 120 checks the activity factor flag bits of the virtual logical address group and finds that the flag bits are all 0, and determines that the virtual logical address group is of low activity level.
[0252] S2302: For the virtual logical address group of the low activity level, the redundancy module 120 calculates redundant check data based on the data of each LBA_BLOCK in the stripe and writes the redundant check data into the LBA_BLOCK corresponding to the check block, and sets the read / write status flag of the LBA_BLOCK corresponding to the check block to 1.
[0253] S2303, for the virtual logical address group with low activity level, the redundant module 120 uses the cache data in the LBA_BLOCK with the read / write status flag position 1 as the target cache data, submits the write operation instruction to the SSD disk, and writes the target cache data to the disk. After writing to the disk, the target cache data needs to be cleared and the read / write status flag position is set to 0.
[0254] For example, if the current redundancy mode is 4+2, with 4 data blocks and 2 redundancy check blocks, and the number of members in a stripe in the namespace is 6, then the number of members in a stripe in the corresponding virtual logical address group is also 6.
[0255] like Figure 10 As shown, for a virtual logical address group with all activity factor flags set to zero, redundancy calculation is performed based on the data in the logical address blocks LBA_BLOCK5, LBA_BLOCK2, LBA_BLOCK1, and LBA_BLOCK0. The calculated parity data is written to the parity blocks LBA_BLOCK4 and LBA_BLOCK3, and the read / write flags of LBA_BLOCK4 and LBA_BLOCK3 are set to 1. This changes the current read / write flags from 100001 to 111001. An SSD write operation instruction is then issued based on the read / write flags, writing the data in LBA_BLOCK5, LBA_BLOCK4, LBA_BLOCK3, and LBA_BLOCK0 (with the read / write flags set to 1) to the SSD. After the write is complete, the cache occupied by the virtual logical address group is released.
[0256] The following describes the cache management method for a storage array according to an embodiment of the present application with reference to another example. In this example, when the cache space corresponding to the current namespace is insufficient, it is necessary to quickly sort out virtual logical address groups that can be cleared to free up cache space for storing data for other read / write commands. The specific steps are as follows:
[0257] S2401: The redundancy module 120 detects that the cache space corresponding to the current namespace is insufficient.
[0258] S2402 , the redundancy module 120 checks the full flag corresponding to each virtual logical address group in the LBAG status table, and uses the virtual logical address group with the full flag set to 1 as the target virtual logical address group that needs to be written to disk.
[0259] S2403 , the redundancy module 120 checks the activity factor flag value of the activity factor flag corresponding to the target virtual logical address group, determines the activity level of the target virtual logical address group according to the activity factor flag value, and selects a target virtual logical address group with a low activity level.
[0260] S2404: For the target virtual logical address group with low activity level, the redundancy module 120 calculates redundant check data based on the data of each LBA_BLOCK of the stripe and writes the check data into the LBA_BLOCK corresponding to the check block.
[0261] At S2405, for the target virtual logical address group with a low activity level, the redundancy module 120 sets the cached data in the LBA_BLOCK with the read / write status flag set to 1 as the target cached data, submits a write instruction to the SSD, and writes the target cached data to the SSD. After writing to the SSD, the target cached data is cleared. Furthermore, after sending the data read from the non-volatile storage array 200 to the remote host 300, the cached data in the LBA_BLOCK with the read / write status flag set to 0 is also cleared.
[0262] In order to improve the management efficiency of the controller memory 140 by the redundancy module 120, the present application further provides a namespace-based cache management method. In the embodiment of the present application, the redundancy module 120 implements a namespace-based cache management method of the present application.
[0263] In the namespace-based cache management method of an embodiment of the present application, for simplicity, the cache in redundancy module 120 does not have separate read and write cache spaces. Data in the cache space may originate from a remote host 300 or a non-volatile storage array 200. The cache is internally divided and managed solely by namespace, with each namespace allocated a separate cache for data storage. Namespaces belonging to different hard drives can write data in parallel. Independent namespace caching prevents data from a single namespace from occupying the entire cache and slowing down overall read and write speeds.
[0264] The namespace-based cache management method is described below with reference to some specific embodiments.
[0265] In the embodiment of the present application, the redundancy module 120 performs cache management on the controller memory 140 (hereinafter referred to as cache) according to the current redundancy mode and the number of NS (Namespace). Exemplarily, the namespace-based cache management method includes the following steps:
[0266] S3210 , allocating a cache area for the access command in the static cache subspace according to the namespace to be accessed by the access command.
[0267] The controller memory 140 in the embodiment of the present application includes a static cache space. It can be understood that the present application utilizes a preset capacity allocation rule to divide the static cache space according to the number of namespaces, and obtains static cache subspaces corresponding to each of the namespaces, as shown in Table 3-1. Thus, a static cache subspace is obtained. For example, a device supports i NS (NameSpace), and the static cache space is divided into i NS, as shown in Table 1. Each namespace corresponds to a static cache subspace. Thus, it is ensured that each NS has a certain amount of cache space. Once a read or write operation command accesses the NS, the remote host 300 can be immediately notified that there is enough cache space to instruct the remote host 300 to send write data; the cache space will not be used up by other NSs and cannot respond to the command.
[0268] Table 3-1 Correspondence between namespaces and static cache subspaces
[0269] Namespace Static cache space NS1 Static cache subspace 1 NS2 Static cache subspace 2 … … NSi Static cache subspace i
[0270] Furthermore, the static cache space is divided according to the number of namespaces using a preset capacity allocation rule, including:
[0271] The static cache space is evenly divided according to the number of namespaces to obtain various static cache subspaces, and the static cache subspaces are fixed.
[0272] Alternatively, the namespaces can be divided based on a preset capacity ratio. For example, a ratio of static cache space occupied by each namespace can be set, and fixed static cache subspaces can be divided for each namespace based on the ratio. However, once a static cache subspace is divided, its capacity is fixed and will not be adjusted based on actual cache usage or the validity of the NS.
[0273] Furthermore, the nonvolatile storage array 200 is mapped into a virtual logical address space based on each of the namespaces. All logical addresses of the nonvolatile storage array 200 are mapped to equal sizes to obtain a virtual logical address space. The virtual logical address space includes virtual logical addresses (referred to as VIR_LBA addresses) that correspond one-to-one with each logical address (referred to as LBA addresses) in the nonvolatile storage array 200, as shown in Table 3-2.
[0274] Table 3-2 Mapping relationship between VIR_LBA address and LBA address in non-volatile storage array
[0275]
[0276] The virtual logical address space is divided according to the number of namespaces to obtain virtual logical address subspaces corresponding to each namespace. Thus, each virtual logical address subspace is obtained. The virtual logical address subspace includes multiple virtual logical addresses, as shown in Table 3-3.
[0277] Table 3-3 Correspondence between namespace and virtual logical address subspace
[0278]
[0279]
[0280] Furthermore, allocating a cache area for the access command in the static cache subspace according to the namespace to be accessed by the access command includes:
[0281] S3211: Obtain a virtual logical address subspace according to the namespace matching.
[0282] S3212: Allocate a target virtual logical address for the access command from the virtual logical address subspace.
[0283] S3213: Allocate the cache area for the target virtual logical address from the static cache subspace uniquely corresponding to the namespace.
[0284] To improve performance and facilitate management, the allocation granularity of the virtual logical address subspace corresponding to the NS is set according to the redundancy mode of the SSD hard disk (non-volatile storage array). The virtual logical address subspace is further divided into multiple stripes according to the number of members in the redundancy group of the SSD hard disk. Specifically, according to the redundancy mode of the non-volatile storage array 200, the virtual logical address subspace is divided into a namespace array. A row of virtual logical addresses in the namespace array is regarded as a stripe, such as Figure 11 As shown (namespace array corresponding to NS1).
[0285] Furthermore, in step S3212, allocating a target virtual logical address for the access command from the virtual logical address subspace includes:
[0286] When the access command is to access any virtual logical address in the stripe, the stripe is assigned to the access command as the target virtual logical address. It can be understood that when an access command accesses any virtual logical address in a stripe, the entire stripe where the virtual logical address is located will be allocated to the access command, and a cache area of the entire stripe size will be requested from the corresponding static cache subspace. Therefore, the static cache subspace should be set to an integer multiple of the stripe length. If a read command is received for NS1 to read the data corresponding to VIR_LBA3, it is necessary to request a corresponding cache area from the static cache subspace in NS1 for the entire stripe where VIR_LBA3 is located.
[0287] In step S3213, allocating the cache area for the target virtual logical address from the static cache subspace uniquely corresponding to the namespace includes:
[0288] If the cache area is not matched according to the stripe, a cache area is allocated to the stripe from the static cache subspace corresponding to the namespace according to the capacity of the stripe.
[0289] In one embodiment, to improve data processing speed, the method of the embodiment of the present application further includes: dividing each namespace within the hard disk group of the non-volatile storage array 200 into a namespace group. Allocating a cache area for the access command in the static cache subspace based on the namespace to be accessed by the access command includes:
[0290] Access commands in different namespace groups are executed in parallel, and cache areas are allocated for corresponding access commands in corresponding static cache subspaces according to the namespaces to be accessed. Figure 12 The figure shows a schematic diagram of an NS Group, where NameSpace1, NameSpace2, and NameSpace3 belong to NS Group1, and NameSpace4, NameSpace5, and NameSpace6 belong to NS Group2. Different namespace groups can be accessed in parallel without affecting each other because they store different hard disk groups. Therefore, limiting the dynamic space usage of a single namespace group is beneficial to improving the overall processing efficiency of the array system.
[0291] S3220: Receive target data for reading and writing the non-volatile storage array 200 based on the access command, and cache the data in the cache area. The static cache subspace is obtained by dividing the static cache space in the controller memory 140 according to the namespace.
[0292] In one embodiment, in order to increase the speed of reading data, the present application also supports pre-reading data. The method further includes:
[0293] S3310: If the access command is a read command for reading a first virtual logical address, determine the stripe in which the first virtual logical address is located according to the first virtual logical address.
[0294] S3320, read the read data corresponding to the stripe in the non-volatile storage array 200; map the logical address of the non-volatile storage array 200 according to the virtual logical addresses corresponding to the stripe, and read the read data in the non-volatile storage array 200 according to the logical address of the non-volatile storage array 200.
[0295] S3330: Cache the read data in a cache area corresponding to the stripe to serve as pre-read data for subsequent reading of other addresses in the stripe except the first virtual logical address.
[0296] For example, if a read command is received from NS1 to read data corresponding to VIR_LBA3, a corresponding cache area must be allocated from the static cache subspace in NS1 for the entire stripe containing VIR_LBA3. Alternatively, only the data corresponding to VIR_LBA3 can be read, or a pre-read operation can be performed to read all the data corresponding to the entire stripe from the non-volatile storage array 200 into the corresponding cache area. A subsequent command to read data corresponding to VIR_LBA4 in the stripe can then be read directly from the cache area, thereby improving data reading efficiency.
[0297] In one embodiment, the controller memory 140 also includes a dynamic shared cache space, such as Figure 13 shown.
[0298] The method further comprises:
[0299] When the static cache subspace corresponding to the namespace is full, a storage area of preset capacity is requested from the dynamic shared cache space for the namespace.
[0300] Furthermore, the method further comprises:
[0301] Whether the application is approved is determined based on the current space capacity, the current space group capacity, and preset space capacity thresholds and space group capacity thresholds. The current space capacity is the current capacity of the static cache subspace already obtained by the namespace; the current space group capacity is the sum of the current capacities of the static cache subspaces obtained by each namespace contained in the namespace group.
[0302] Exemplarily, if the current capacity of the space group corresponding to the namespace group does not reach the space group capacity threshold, and the current capacity of the space corresponding to the namespace does not reach the space capacity threshold, then the application is determined to be approved, that is, the storage area is allowed to be allocated from the dynamic shared cache space, otherwise the application is rejected.
[0303] In other words, in order to prevent a certain NS from occupying a large amount of dynamic space and affecting the use of other NSs, the embodiment of the present application sets a watermark for the dynamic space that can be applied for for each NS and the namespace group in which the NS is located. The application of dynamic space for all namespaces belonging to the same namespace group is limited by the watermark of the namespace itself and the namespace group to which it belongs (i.e., the threshold). When a namespace applies for dynamic space and touches any of the above watermarks, no more dynamic space will be allocated to it.
[0304] Furthermore, the method further comprises:
[0305] If the static cache subspace is full and the request is rejected, the write data and pre-read data in the static cache subspace corresponding to the namespace are cleared. To execute commands, the namespace needs to free up cache space occupied by completed commands. For write command caches, this triggers the backend to flush data to disk as quickly as possible; for read command caches, pre-read data is cleared.
[0306] The following describes the namespace-based cache management method according to an embodiment of the present application with reference to an example of a write command, which specifically includes the following steps:
[0307] S3401: The redundancy module 120 receives a write command and allocates an idle virtual logical address VIR_LBA according to the namespace accessed by the current write command and the length of the data to be written, which is recorded as the first address.
[0308] S3402: The redundancy module 120 determines whether the stripe to which the first address belongs has been allocated a cache area according to the cache status table. If the stripe has been allocated a cache area, step S403 is executed; if not, step S404 is executed.
[0309] S3403 , the redundancy module 120 sends an R2T (Ready to Transfer, indicating that the cache area is ready) to the remote host 300 to instruct the remote host 300 to send the data to be written.
[0310] S3404: The redundancy module 120 determines whether there is any free cache area in the static cache sub-area of the namespace corresponding to the stripe. If there is a free cache area, step S3405 is executed; otherwise, step S3406 is executed.
[0311] S3405 , the redundancy module 120 allocates an available fixed cache area to the stripe from the static cache sub-area corresponding to the namespace.
[0312] S3406, the redundancy module 120 determines whether the dynamic shared cache space applied for by the currently accessed NS triggers the preset watermark (including the space capacity threshold and the space group capacity threshold). If triggered, cache cleanup is performed and the released cache space is allocated to the stripe. If not triggered, the corresponding shared cache area is allocated from the dynamic shared cache space to the stripe.
[0313] S3407, sends R2T (Ready to Transfer, indicating that the cache area is ready) to the remote host 300 to instruct the remote host 300 to send the data to be written, and stores the received data to be written into the second address (physical address of the cache space) corresponding to the first address (VIR_LBA of NS) in the allocated cache area.
[0314] The present application also provides a terminal device. Exemplarily, the terminal device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the terminal device to execute the above-mentioned storage array data reading and writing method or the functions of each module in the above-mentioned redundant module device.
[0315] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.
[0316] The memory may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.
[0317] The present application also provides a computer-readable storage medium for storing the computer program used in the terminal device. For example, the computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0318] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architectures, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or flowchart, and the combination of boxes in the structure diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.
[0319] In addition, the functional modules or units in the various embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0320] If the functions are implemented in the form of software function modules 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, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a smart phone, personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application.
[0321] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.
Claims
1. A method for reading and writing data in a storage array, characterized in that: Applied to a storage array controller, the storage array controller includes a storage interface control module, a redundancy module, a controller memory, and a non-volatile storage control module, including: Mapping the logical address of the storage array to a virtual logical address in a virtual logical address space, and dividing the virtual logical address space into a plurality of virtual logical address subspaces according to the number of namespaces; The virtual logical address subspace is divided into a namespace array according to a redundancy mode of the storage array, and a row of virtual logical addresses in the namespace array is regarded as a stripe; Determining a corresponding cache address space in a cache space management table according to an index of a target address stripe in an access command to a storage array, wherein the cache space management table records a cache address space corresponding to each stripe stored in a memory of the controller; According to the cache address space, the read and write data determined based on the access command to the storage array is cached in the controller memory; wherein If the access command is a read command, reading target data and pre-read data according to the target address stripe and caching them in the controller memory; and The target data is sent.
2. The storage array data reading and writing method according to claim 1, wherein: Determining the corresponding cache address space in the cache space management table according to the index of the target address stripe in the access command to the storage array includes: Determining a target namespace and a target virtual logical address to be accessed according to an access command to the storage array; The target address stripe is determined according to the target namespace and the target virtual logical address.
3. The storage array data reading and writing method according to claim 1, wherein: Determining the corresponding cache address space in the cache space management table according to the index of the target address stripe in the access command to the storage array includes: Matching the cache address space in the cache space management table according to the index; If the match fails, dividing the cache address space from the controller memory for the target address stripe; If the match is successful, the index is obtained, and the corresponding cache address space in the cache space management table is obtained.
4. The storage array data reading and writing method according to claim 3, wherein: The method further includes: storing the divided cache address space into the cache space management table according to the sequence number of the target address stripe.
5. The storage array data reading and writing method according to claim 1, wherein: The step of caching the read and write data determined based on the access command to the storage array into the controller memory according to the cache address space includes: If the read / write data is write data, the write data is cached in the controller memory and a command completion message is sent to the remote host.
6. The storage array data reading and writing method according to claim 5, characterized in that: If the read / write data is write data, then after caching the write data in the controller memory, sending command completion information to the remote host, including: Performing integrity check on the write data; If the verification fails, a prompt message indicating a data write error is sent to the remote host; If the verification passes, a command completion message is sent to the remote host.
7. The storage array data reading and writing method according to claim 1, wherein: The method further comprises: If the access command is a read command, determining the target address stripe to which the virtual logical address segment to be accessed by the read command belongs according to the virtual logical address segment to be accessed; Matching a target cache address space in the cache space management table according to the index of the target address stripe; If the match is successful, the pre-read data is read from the target cache address space according to the cache address to be accessed by the read command.
8. The storage array data reading and writing method according to claim 1, wherein: The step of reading target data and pre-read data according to the target address stripe and caching the data in the controller memory includes: Acquire, according to the target address stripe, continuous virtual logical address segments adjacent to the virtual logical address segment of the target data; The target data and the pre-read data are read from the storage array according to the virtual logical address segment and cached in the controller memory.
9. The storage array data reading and writing method according to any one of claims 1 to 8, characterized in that: The method further includes: writing the write data cached in the controller memory into the storage array according to the data activity level.
10. A storage array controller, characterized in that: Applied to a storage array controller, the storage array controller includes a storage interface control module, a redundancy module, a controller memory and a non-volatile storage control module; The redundancy module is respectively connected to the storage interface control module, the non-volatile storage control module and the controller memory; The redundancy module is used to implement the storage array data reading and writing method according to any one of claims 1 to 9.
11. A terminal device, characterized in that: The terminal device includes a processor and a memory, the memory stores a computer program, and the processor is configured to execute the computer program to implement the storage array data reading and writing method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that The device stores a computer program, which, when executed on a processor, implements the storage array data reading and writing method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Formatting scheduling method and device for redundant array of independent disks, equipment and medium
CN114995771A
Distributed storage location hinting for non-volatile memories
US20190042144A1