Annular cache region construction method and system, storage medium and electronic equipment

By building a ring cache area on the RAID card and utilizing the host memory buffering feature, the problem of insufficient data storage capacity caused by limited hardware resources of RAID card is solved, and a larger data storage capacity and higher storage efficiency are achieved.

CN119473170AInactive Publication Date: 2025-02-18SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD

Patent Information

Application Number
CN202510061946.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-15
Publication Date
2025-02-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The RAID card firmware runs limited hardware resources, resulting in insufficient capacity for data storage.

Method used

By determining whether the RAID card supports the host memory buffering characteristics, allocate memory space, and send enable instructions to the RAID card, the RAID card builds a ring cache area in the memory space to store the written data.

Benefits of technology

The data storage capacity has been expanded, the data storage efficiency has been improved, and the problem of insufficient data storage capacity caused by limited hardware resources of RAID card is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473170A_ABST
    Figure CN119473170A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the field of computers, in particular to a construction method and system of an annular cache region, a storage medium and electronic device.The construction method of the annular cache region comprises the steps that whether an RAID card supports the host memory buffering characteristic or not is determined; under the condition of determining that the RAID card supports the host memory buffer characteristic, allocating a memory space for the RAID card; and sending an enabling instruction to the RAID card, so that the RAID card constructs an annular cache region in the memory space according to the enabling instruction and the host memory buffer characteristic, and the annular cache region is used for storing data written into the host by the RAID card. Through the embodiment of the invention, the problem of insufficient data storage capacity caused by limited hardware resources for running of RAID card firmware in related technologies can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the computer field, and in particular, to a method and system for constructing a circular buffer, a storage medium, and an electronic device. Background Art

[0002] At present, in the product development stage or laboratory problem analysis stage, developers can connect the Redundant Array of Independent Disks controller card (RAID card) (with a reserved serial interface) to the debugging personal computer (PC) through a serial port line, open the serial terminal tool on the debugging PC, receive the logs, debugging data and other contents output from the RAID card through the serial interface, and save them to the hard disk of the debugging PC in text or other ways for subsequent in-depth analysis. In the product application stage, since the RAID card is usually inserted into the PCIe interface slot of the host, the host is placed in the cabinet, and the on-site environment is not convenient to connect the RAID card to the debugging PC through a serial port line to receive logs, data and other contents in real time. It is usually adopted to write data to non-volatile storage media first. When it is necessary to carry out fault analysis and event tracing, the RAID card configuration management tool on the host sends a data export command to the RAID card to export the data to the host for further data analysis.

[0003] Since the hardware resources (central processing unit (CPU), random access memory (RAM), flash memory (Flash), etc.) used by the RAID card for firmware operation are usually small, and the RAM space allocated for the log ring buffer is usually only tens of KB to hundreds of KB, and the Flash capacity is usually tens of MB to hundreds of MB, the available hardware resources limit the capacity of the stored logs and data.

[0004] Therefore, in the related art, the problem of insufficient data storage capacity caused by limited hardware resources for running RAID card firmware has not been effectively solved. Summary of the invention

[0005] The embodiments of the present application provide a method and system for constructing a circular buffer area, a storage medium, and an electronic device to at least solve the problem of insufficient data storage capacity caused by limited hardware resources for running RAID card firmware in the related art.

[0006] According to an embodiment of the present application, a method for constructing a circular buffer area is provided, which is applied to a host and specifically includes: determining whether a RAID card supports a host memory buffer feature; allocating memory space to the RAID card when it is determined that the RAID card supports the host memory buffer feature; sending an enable instruction to the RAID card so that the RAID card constructs a circular buffer area in the memory space according to the enable instruction and the host memory buffer feature, wherein the circular buffer area is used to store data written to the host by the RAID card.

[0007] In an exemplary embodiment, determining whether a RAID card supports a host memory buffer feature includes: establishing a communication link with the RAID card based on a target protocol; acquiring a capability set supported by the RAID card according to the communication link; and determining whether the RAID card supports the host memory buffer feature according to the capability set.

[0008] In an exemplary embodiment, after sending an enable instruction to the RAID card so that the RAID card builds a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics, the method also includes: upon receiving first data written by the RAID card, determining a target space amount of the first data and a first remaining space amount of the circular buffer area; comparing a first size relationship between the target space amount and the first remaining space amount; and instructing the RAID card to write the first data to the circular buffer area according to the first size relationship.

[0009] In an exemplary embodiment, instructing the RAID card to write the first data to the circular buffer area according to the first size relationship includes: when the first size relationship indicates that the target space amount is less than or equal to the first remaining space amount, instructing the RAID card to write the first data to the circular buffer area; when the first size relationship indicates that the target space amount is greater than the first remaining space amount, determining the priority of the data in the circular buffer area; deleting the second data in the circular buffer area according to the priority, and updating the remaining space amount of the circular buffer area from the first remaining space amount to the second remaining space amount; comparing the second size relationship between the target space amount and the second remaining space amount; when the second size relationship indicates that the target space amount is less than or equal to the second remaining space amount, instructing the RAID card to write the first data to the circular buffer area.

[0010] In an exemplary embodiment, determining the priority of the data in the circular buffer includes: determining the write time of each data in the circular buffer; and determining the priority of each data in the circular buffer according to multiple write times.

[0011] In an exemplary embodiment, after instructing the RAID card to write the first data to the circular buffer area according to the first size relationship, the method also includes: determining whether the first data is allowed to be written to the solid-state drive; if it is determined that the first data is allowed to be written to the solid-state drive, determining whether the priority of the first data in the circular buffer area is the highest priority; if it is determined that the priority corresponding to the first data is the highest priority, writing the first data to the solid-state drive.

[0012] In an exemplary embodiment, before instructing the RAID card to write the first data to the circular buffer area according to the first size relationship, the method also includes: parsing the first data to obtain a first check code corresponding to the first data, and obtaining a second check code corresponding to the first data, wherein the second check code is a check code determined by the RAID card based on a target algorithm and the first data; comparing the first check code and the second check code; and when the comparison result indicates that the first check code and the second check code are consistent, determining that the first data is complete, and allowing the first data to be written to the circular buffer area.

[0013] According to another embodiment of the present application, a method for constructing a circular buffer area is provided, which is applied to a RAID card, and specifically includes: when an enable instruction sent by a host is received, a circular buffer area is constructed in a memory space according to the enable instruction and the host memory buffer characteristic, wherein the host is used to: determine whether the RAID card supports the host memory buffer characteristic; when it is determined that the RAID card supports the host memory buffer characteristic, memory space is allocated to the RAID card, and the enable instruction is sent to the RAID, and the circular buffer area is used to store data in the RAID card.

[0014] In an exemplary embodiment, a circular buffer area is constructed in the memory space according to the enable instruction and the host memory buffer characteristic, including: determining whether a first address and a first memory capacity sent by the host are received, wherein the first memory capacity is the memory capacity of the memory space, and the first address is the first address corresponding to the memory space; when it is determined that the first address and the first memory capacity are received, enabling the memory buffer characteristic according to the enable instruction, and establishing the circular buffer area in the memory space based on the first address, wherein the second memory capacity of the circular buffer area is less than or equal to the first memory capacity.

[0015] In an exemplary embodiment, after constructing a circular buffer in the memory space according to the enable instruction and the host memory buffer characteristics, the method further includes: setting a producer identifier and a consumer identifier in the circular buffer, wherein the producer identifier is used to indicate the starting position of the data in the circular buffer, and the consumer identifier is used to indicate the ending position of the data in the circular buffer; sending the producer identifier and the consumer identifier to the host so that the host manages the data in the circular buffer.

[0016] In an exemplary embodiment, after sending the producer identifier and the consumer identifier to the host, the method further includes: when writing third data to the circular buffer area, sending update information to the host based on the target protocol, so that the host updates the producer identifier and the consumer identifier according to the update information.

[0017] According to another embodiment of the present application, a system for constructing a circular buffer area is provided, including: a host, used to determine whether a RAID card supports a host memory buffer feature; when it is determined that the RAID card supports the host memory buffer feature, allocating memory space to the RAID card and sending an enable instruction to the RAID card; and a RAID card, used to, when receiving the enable instruction sent by the host, construct a circular buffer area in the memory space according to the enable instruction and the host memory buffer feature, wherein the circular buffer area is used to store data in the RAID card.

[0018] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0019] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in the above method embodiment.

[0020] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiment are implemented.

[0021] Through the method for constructing the circular buffer area of ​​the present application, it is determined whether the RAID card supports the host memory buffer feature. When it is determined that the RAID card supports the host memory buffer feature, memory space is allocated to the RAID card. An enable instruction is sent to the RAID card so that the RAID card constructs a circular buffer area in the memory space for storing the data written to the host by the RAID card according to the enable instruction and the host memory buffer feature. In other words, when it is determined that the RAID card has the host memory buffer feature, the embodiment of the present application constructs a circular buffer area in the host through the host memory buffer feature of the RAID card, thereby solving the problem of insufficient data storage capacity caused by limited hardware resources for the operation of the RAID card firmware in the related art. And then expand the data storage capacity. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a hardware structure block diagram of a computer terminal of a method for constructing a ring buffer area in an embodiment of the present application;

[0023] Figure 2 is a flow chart (I) of a method for constructing a ring buffer according to an embodiment of the present application;

[0024] Figure 3 is a flow chart (II) of a method for constructing a ring buffer according to an embodiment of the present application;

[0025] Figure 4 It is a schematic diagram of storing data according to a RAID card in the related art;

[0026] Figure 5 is a schematic diagram of a method for storing logs in a RAID card according to an optional embodiment of the present application;

[0027] Figure 6 is a flow chart of a method for storing logs in a RAID card according to an optional embodiment of the present application;

[0028] Figure 7 It is a structural block diagram of a system for constructing a circular buffer area according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0031] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal for a method for constructing a ring buffer area in an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned computer terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0032] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for determining the interactive state in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0033] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0034] Figure 2 is a flowchart of a method for constructing a ring buffer according to an embodiment of the present application (I), which can be applied to Figure 1 In a computer terminal, the computer terminal can be used for a host, such as Figure 2 As shown, the process includes the following steps:

[0035] Step S202, determining whether the RAID card supports the host memory buffer feature;

[0036] Step S204, when it is determined that the RAID card supports the host memory buffer feature, allocating memory space to the RAID card;

[0037] Step S206, sending an enable instruction to the RAID card, so that the RAID card constructs a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics, wherein the circular buffer area is used to store data written by the RAID card to the host.

[0038] Through the method for constructing the circular buffer area of ​​the present application, it is determined whether the RAID card supports the host memory buffer feature. When it is determined that the RAID card supports the host memory buffer feature, memory space is allocated to the RAID card. An enable instruction is sent to the RAID card so that the RAID card constructs a circular buffer area in the memory space for storing the data written to the host by the RAID card according to the enable instruction and the host memory buffer feature. In other words, when it is determined that the RAID card has the host memory buffer feature, the embodiment of the present application constructs a circular buffer area in the host through the host memory buffer feature of the RAID card, thereby solving the problem of insufficient data storage capacity caused by limited hardware resources for the operation of the RAID card firmware in the related art. And then expand the data storage capacity.

[0039] Optionally, step S202 of determining whether the RAID card supports the host memory buffer feature includes: establishing a communication link with the RAID card based on the target protocol; obtaining a capability set supported by the RAID card according to the communication link; and determining whether the RAID card supports the host memory buffer feature according to the capability set.

[0040] It is understandable that the method to determine whether the RAID card supports the host memory buffer feature (i.e., HMB feature) is:

[0041] 1) Establish a communication link with the RAID card based on the target protocol: The target protocol can be the Non-Volatile Memory express (NVMe protocol), which is a high-speed storage protocol designed for solid-state drives that specifically optimizes the use of the Peripheral Component Interconnect Express (PCIe) bus. The process of establishing a communication link is the basic setting for the host to connect to the RAID card through the PCIe bus and use the NVMe protocol for communication. This usually involves the initialization of the PCIe link and the establishment of the NVMe communication session to ensure that data can be exchanged between the host and the RAID card.

[0042] 2) Obtain the capability set supported by the RAID card based on the communication link: Once the communication link is established, the host can obtain the capability information of the RAID card through specific commands of the NVMe protocol (such as the Identify Controller command). This information usually includes the functions, features and configuration parameters supported by the RAID card. For the HMB feature, the host needs to query whether the RAID card lists HMB support in the capability set, which usually includes information such as the maximum available capacity of the HMB and the access mode of the HMB.

[0043] 3) Determine whether the RAID card supports the host memory buffer feature based on the capability set: After obtaining the capability set of the RAID card, the host needs to parse this information and check the support of the HMB feature. If the capability set of the RAID card indicates that it supports HMB, the host can further configure and utilize this feature. For example, the host can allocate a memory area as a buffer for the RAID card, and then notify the RAID card of the address and size of this dedicated memory through NVMe protocol commands, thereby allowing the RAID card to store logs, data or other information in this memory buffer instead of the RAID card's own limited cache or non-volatile storage when writing them.

[0044] Through the above technical solution, without increasing the hardware cost of the RAID card, through the support of software and protocols, the host's large amount of memory is used to enhance the log storage and data processing capabilities of the RAID card, thereby improving the reliability and performance of the overall system.

[0045] Optionally, after sending an enable instruction to the RAID card in the above step S206 so that the RAID card builds a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics, the method also includes: upon receiving first data written by the RAID card, determining a target space amount of the first data and a first remaining space amount of the circular buffer area; comparing a first size relationship between the target space amount and the first remaining space amount; and instructing the RAID card to write the first data to the circular buffer area according to the first size relationship.

[0046] Wherein, instructing the RAID card to write the first data into the ring buffer area according to the first size relationship includes:

[0047] When the first size relationship indicates that the target space amount is less than or equal to the first remaining space amount, instruct the RAID card to write the first data to the circular buffer area; when the first size relationship indicates that the target space amount is greater than the first remaining space amount, determine the priority of the data in the circular buffer area; delete the second data in the circular buffer area according to the priority, and update the remaining space amount of the circular buffer area from the first remaining space amount to the second remaining space amount; compare the second size relationship between the target space amount and the second remaining space amount; when the second size relationship indicates that the target space amount is less than or equal to the second remaining space amount, instruct the RAID card to write the first data to the circular buffer area.

[0048] It can be understood that the first data is written into the ring buffer area, specifically:

[0049] 1) Determine the data writing conditions.

[0050] When the RAID card starts to generate logs, alarms, events, data and other information, it will prepare to write this information (i.e., the first data) into the circular buffer area provided by the host memory. Before writing the data, the host needs to confirm two key information: 1. The amount of space occupied by the first data (i.e., the target space amount); 2. How much space is currently available for storage in the circular buffer area (i.e., the first remaining space amount).

[0051] 2) Compare the amount of data with the remaining space.

[0052] The host may compare the size relationship between the target space amount and the first remaining space amount to determine whether the first data can be directly written into the ring buffer area.

[0053] (1) If the target space is less than or equal to the first remaining space of the circular buffer, the host will directly instruct the RAID card to write data because there is enough space to accommodate the first data.

[0054] (2) If the amount of data exceeds the remaining space, that is, the target space is greater than the first remaining space, it means that the current space of the circular buffer is insufficient to store the first data. At this time, the host needs to further process and delete the data in the circular buffer to ensure that the data can be saved and not lost.

[0055] 3) Delete data based on priority.

[0056] According to the determined priority, the host instructs the RAID card to delete the second data with a lower priority in the circular buffer area to free up enough space. After the deletion, the remaining space amount of the circular buffer area is updated from the first remaining space amount to the second remaining space amount, and the second remaining space amount is the new available space after the deletion operation.

[0057] 4) Re-compare and re-write.

[0058] The host compares the target space amount with the updated second remaining space amount again. If the target space amount is less than or equal to the second remaining space amount, the host will again instruct the RAID card to write the first data into the circular buffer area to ensure that the data is preserved.

[0059] The above technical solution ensures that the RAID card can store and manage important data as efficiently and reasonably as possible within the limited storage space, while avoiding information loss caused by data overflow, improving the integrity of data records and system reliability. Through such a dynamic adjustment strategy, even under high load, the system can effectively utilize the additional memory space provided by HMB through data priority management to improve the storage efficiency of logs and data.

[0060] Wherein, determining the priority of the data in the circular buffer area includes: determining the write time of each data in the circular buffer area; and determining the priority of each data in the circular buffer area according to multiple write times.

[0061] It is understandable that the priority can be determined based on a variety of criteria, such as the timeliness and importance of the data, which helps to determine which data can be temporarily sacrificed to free up space. In the embodiment of the present application, the priority of the data is determined by the writing time of the data.

[0062] Among them, after instructing the RAID card to write the first data to the circular buffer area according to the first size relationship, the method also includes: determining whether the first data is allowed to be written to the solid-state drive; if it is determined that the first data is allowed to be written to the solid-state drive, determining whether the priority of the first data in the circular buffer area is the highest priority; if it is determined that the priority corresponding to the first data is the highest priority, writing the first data to the solid-state drive.

[0063] It is understandable that after writing the first data to the ring buffer area, the first data also needs to be written from the ring buffer area to the solid state drive. Specifically:

[0064] 1) Determine whether to allow first data to be written to the solid state drive.

[0065] When the RAID card processes data, it may receive a large amount of data from different modules or applications, which have different importance and urgency. Therefore, the RAID card needs to determine whether the data should be persisted to the SSD immediately or can be temporarily cached in the ring buffer. This judgment may be based on a variety of factors, such as: the current state of the SSD (whether a write operation is in progress), the system's resource utilization (for example: CPU load, etc.), the importance of the data, etc.

[0066] 2) Determine whether the priority of the first data in the ring buffer is the highest priority.

[0067] Although the ring buffer has a large capacity of memory, it is still a limited resource. When the buffer is close to full, the RAID card needs to decide which data should be written to the SSD first to make room. The priority setting can be based on the type and source of the data, the impact on system stability and performance, etc. For example, the system critical event log may be given the highest priority to ensure that the data can be persisted in a timely manner even when resources are tight.

[0068] 3) When it is determined that the priority corresponding to the first data is the highest priority, the first data is written to the solid state drive.

[0069] If the first data is determined to have the highest priority, the RAID card will immediately take action to write this part of the data to the SSD. This process may include: Data preparation: Ensure that the data is complete and correct before writing, and verification or formatting may be required. Write operation: Transfer data from the circular buffer to the SSD through the NVMe protocol or other suitable protocols. Status update: After the data is written, update the write status of the SSD, and may clear the corresponding data in the circular buffer to free up space. Error handling: If an error occurs during the writing process, the RAID card needs to have a corresponding mechanism to handle these errors, which may include data rewriting, error logging, etc.

[0070] Through this priority-based write strategy, the RAID card can more intelligently manage the data interaction between it and the SSD, ensuring that the most important data is saved first, while reducing unnecessary write operations, improving the overall efficiency of the system and data security. This mechanism is not only applicable to RAID cards, but can also be extended to other scenarios that require efficient data storage and management.

[0071] Wherein, before instructing the RAID card to write the first data to the circular buffer area according to the first size relationship, the method also includes: parsing the first data to obtain a first check code corresponding to the first data, and obtaining a second check code corresponding to the first data, wherein the second check code is a check code determined by the RAID card based on a target algorithm and the first data; comparing the first check code and the second check code; and when the comparison result indicates that the first check code and the second check code are consistent, determining that the first data is complete, and allowing the first data to be written to the circular buffer area.

[0072] It is understandable that before writing the first data into the ring buffer area, the data integrity of the first data needs to be verified. Specifically:

[0073] 1) Data analysis and verification code generation:

[0074] When the service module of the RAID card generates first data to be stored, the data is firstly acquired through a parsing mechanism.

[0075] Subsequently, a standard algorithm for data verification (ie, a target algorithm) is used to process the first data to generate a first verification code corresponding to the first data.

[0076] Before sending the data to the host, the RAID card has generated a second check code for the first data, written the second check code to the head and tail of the first data, packaged the second check code and the first data, and sent them to the host.

[0077] 2) Verification code comparison:

[0078] Before writing the first data into the ring buffer, the system performs a comparison operation between the first check code and the second check code.

[0079] The comparison operation ensures that the data has not been tampered with or damaged during transmission or processing, that is, if the two check codes are consistent, it can be considered that the first data has maintained integrity during the process from generation to transmission.

[0080] 3) Data integrity confirmation and writing:

[0081] If the comparison result indicates that the first verification code is consistent with the second verification code (ie, the verification passes), the system determines that the first data is complete and has not been damaged or modified.

[0082] On the basis of confirming the data integrity, the RAID card is allowed to write the first data into the ring buffer area for storage.

[0083] The above technical solution can effectively improve the reliability of data stored in the ring buffer area, avoiding the difficulties of fault analysis and event tracing caused by data damage or errors. This is an optimization of the traditional data storage process, especially in situations such as RAID cards that require high data reliability and performance, adding additional data verification steps can improve the overall quality of data storage.

[0084] Figure 3 Flowchart (II) of a method for constructing a ring buffer according to an embodiment of the present application, which is applied to a RAID card, such as Figure 3 As shown, the process includes the following steps:

[0085] Step S302, when receiving an enable instruction sent by the host, constructing a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristic, wherein the host is used to: determine whether the RAID card supports the host memory buffer characteristic; when it is determined that the RAID card supports the host memory buffer characteristic, allocate memory space to the RAID card and send the enable instruction to the RAID, and the circular buffer area is used to store data in the RAID card.

[0086] Through the method for constructing the circular buffer area of ​​the present application, it is determined whether the RAID card supports the host memory buffer feature. When it is determined that the RAID card supports the host memory buffer feature, memory space is allocated to the RAID card. An enable instruction is sent to the RAID card so that the RAID card constructs a circular buffer area in the memory space for storing the data written to the host by the RAID card according to the enable instruction and the host memory buffer feature. In other words, when it is determined that the RAID card has the host memory buffer feature, the embodiment of the present application constructs a circular buffer area in the host through the host memory buffer feature of the RAID card, thereby solving the problem of insufficient data storage capacity caused by limited hardware resources for the operation of the RAID card firmware in the related art. And then expand the data storage capacity.

[0087] Optionally, step S302 of constructing a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics includes: determining whether the first address and the first memory capacity sent by the host are received, wherein the first memory capacity is the memory capacity of the memory space, and the first address is the first address corresponding to the memory space; when it is determined that the first address and the first memory capacity are received, enabling the memory buffer characteristics according to the enable instruction, and establishing the circular buffer area in the memory space based on the first address, wherein the second memory capacity of the circular buffer area is less than or equal to the first memory capacity.

[0088] It can be understood that a circular buffer area is constructed in the memory space according to the enable instruction and the host memory buffer characteristics, specifically including:

[0089] 1) Determine whether the first address and the first memory capacity sent by the host are received:

[0090] First address: refers to the starting address of the exclusive memory block allocated by the host to the RAID card for use, which is a specific location in the physical memory.

[0091] First, memory capacity: the size of the memory block allocated by the host to the RAID card, usually in bytes, which determines the size of the memory space that the RAID card can use.

[0092] During the communication between the RAID card and the host, the host needs to send the above information to the RAID card through the NVMe protocol to inform the RAID card which part of the host's memory it can now use as a log buffer.

[0093] 2) upon determining that the first address and the first memory capacity are received, enabling the memory buffer feature according to the enable instruction:

[0094] Once the RAID card confirms that it has received the first address and first memory capacity information sent by the host, as well as the instruction to enable the HMB feature, it will activate the HMB feature. The activation process may include the configuration of the RAID card's internal software to ensure that it can correctly access and use these memories.

[0095] 3) Based on the first address, the circular buffer is established in the memory space:

[0096] The ring buffer is an efficient memory management structure that can circulate a fixed-size space in the memory to avoid memory fragmentation. Under the HMB mechanism, the RAID card will set the memory allocated to it by the host (the memory space determined by the first address and the first memory capacity) as a ring buffer to store logs, data and other information.

[0097] The establishment of the circular buffer area starts from the first address provided by the host and is implemented by the firmware of the RAID card. The firmware needs to manage the producer ID and consumer ID of the circular buffer area to ensure the correct storage and reading of information.

[0098] 4) The second memory capacity of the ring buffer is less than or equal to the first memory capacity:

[0099] The second memory capacity is the actual memory size used by the ring buffer. Since there may be certain overhead in the establishment and management of the ring buffer (for example, management structure, pointer, etc.), the actual available memory capacity may be less than the first memory capacity allocated by the host, but in any case, the second memory capacity will not exceed the first memory capacity.

[0100] This setting ensures that the RAID card does not exceed the allocated range when using the host memory. It also takes into account possible memory management requirements in actual use, so that the size of the ring buffer area adapts to actual storage and processing needs.

[0101] By utilizing the combination of HMB features and the circular buffer area, the log and data storage capabilities of the RAID card can be significantly improved without increasing hardware costs, thereby improving the efficiency of fault analysis and event tracking, while reducing the usage pressure of the RAID card hardware resources and enhancing its overall performance.

[0102] Optionally, after constructing a circular buffer in the memory space according to the enable instruction and the host memory buffer characteristics in step S302, the method further includes: setting a producer identifier and a consumer identifier in the circular buffer, wherein the producer identifier is used to indicate the starting position of the data in the circular buffer, and the consumer identifier is used to indicate the ending position of the data in the circular buffer; and sending the producer identifier and the consumer identifier to the host so that the host manages the data in the circular buffer.

[0103] Among them, after sending the producer identifier and the consumer identifier to the host, the method also includes: when writing the third data to the circular buffer area, sending update information to the host based on the target protocol, so that the host updates the producer identifier and the consumer identifier according to the update information.

[0104] It is understandable that after building the circular buffer, it is also necessary to build the producer identifier and consumer identifier, specifically:

[0105] 1) Build a circular buffer: When the RAID card and the host establish a communication link through the PCIe interface and confirm that the RAID card supports the HMB feature through NVMe protocol interaction information, the host will allocate a free memory area, that is, memory space, to the RAID card. The memory space is a dedicated memory area allocated by the host to the RAID card. During its initialization phase, the RAID card will use this dedicated memory to build a circular buffer to store logs, data and other information.

[0106] 2) Set the producer ID and consumer ID: In the circular buffer, two identifiers need to be set, namely the producer ID and the consumer ID. The producer ID indicates the starting position of the data in the circular buffer, that is, the position currently available for writing new data; the consumer ID indicates the end position of the data in the circular buffer, that is, the host should start reading data from here. These two identifiers are an integral part of the circular buffer management, and they help the RAID card and the host track the data status in the buffer.

[0107] 3) Sending identifiers to the host: Once the producer and consumer identifiers are set, the RAID card will send these two identifiers to the host, allowing the host to know the storage status of the data in the circular buffer area. Allowing the host to read the data at the appropriate time to avoid data loss or overwriting.

[0108] 4) Data writing and identifier updating: When the RAID card needs to write third data (i.e., newly generated logs or data) to the circular buffer, it will write the data to the location indicated by the producer identifier according to the management rules of the circular buffer. After writing is completed, the RAID card will send update information to the host based on the NVMe protocol. This update information contains the new producer identifier and / or consumer identifier, as well as possible other status information, to notify the host that the data status in the buffer has changed.

[0109] 5) Host update identifier: After receiving the update information, the host will update its management status of the circular buffer according to the information in it, that is, update the producer identifier and consumer identifier. That is, the host can know which data in the circular buffer is new and which data has been read, so that it can effectively manage and read these data for subsequent fault analysis and event tracking.

[0110] Through the above technical solution, the RAID card can efficiently use the host's free memory as a log buffer without increasing its own hardware cost, while ensuring the integrity and timeliness of the data and improving the accuracy and efficiency of fault analysis.

[0111] In order to better understand the process of the above-mentioned method for constructing the circular buffer area, the implementation process of the above-mentioned method for constructing the circular buffer area is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.

[0112] At present, the board that realizes the RAID function is the RAID card. Its core is the RAID control chip, which has its own CPU, RAM, Flash and peripheral interfaces. It is usually connected to the host using the PCIe interface and can communicate using the NVMe protocol. The logs, alarms, events, data and other contents generated during the operation of the RAID card firmware need to be cached in RAM or saved in non-volatile storage media. When conducting RAID card fault analysis and event tracing, product operation and maintenance engineers first export logs, data and other contents to the host, store them in the hard disk, and then use text editors, data analysis tools, etc. to conduct data analysis.

[0113] Among the commonly used log, data and other content storage and export methods of RAID cards, the serial port method is used to receive the output information of the RAID card in real time and transmit it to the debugging PC, but the serial port transmission rate is low, in order to solve the rate mismatch.

[0114] Therefore, asynchronous data transmission is usually adopted, that is, a space is allocated in RAM and managed in a circular buffer. The business module will first store the generated data in the circular buffer, and the task run by the log management module will periodically retrieve the data from the circular buffer and output it to the debugging PC through the serial port. Alternatively, the data can be written to a non-volatile storage medium. The business module can use the API for writing to a non-volatile storage medium to directly store the data. However, the data generated by the business module at a time is small, and the non-volatile storage medium will be frequently operated during storage, which will have a certain impact on the performance of the product. Alternatively, asynchronous transmission is adopted, first the data is stored in a circular buffer, and then the cached data is written to the non-volatile storage medium periodically or when the cached data capacity reaches the threshold, so as to improve the product performance by reducing the operation frequency.

[0115] Figure 4 It is a schematic diagram of storing data according to the RAID card in the related art, such as Figure 4 As shown, there is a circular buffer area 1 in the RAM, and the circular buffer area 1 and the RAM exist together in the RAID card. The log data corresponding to the CPU is cached in the circular buffer area 1. The RAID card also includes a Universal Asynchronous Receiver / Transmitter (UART) and Flash. The UART is connected to the debugging RC through a serial port line, and the data in the circular buffer area 1 can be sent to the debugging PC. When the host exports data, it first reads the data from the Flash of the RAID card, and then transmits it to the host in batches. The host then transmits the data to the hard disk. The RAID card and the host connect the peripheral component interconnect high-speed endpoint (i.e., PCle) on the RAID card. Figure 4 PCle endpoint in the host) and the root composite device in the host (i.e. Figure 4 Root complex in the connection.

[0116] The capacity of the ring buffer 1 directly affects the amount of data stored. If the capacity of the ring buffer 1 is small, the stored data is small, which is not enough to record the firmware running status of the RAID card in detail, which is not conducive to the fault analysis and event tracing of the RAID card. At the same time, the firmware cannot take out data from the ring buffer 1 for transmission or storage in time, and there is not enough space in the ring buffer 1 to store the newly generated data, which will cause the unprocessed historical data to be overwritten or the newly generated data to be discarded.

[0117] In view of the above problems, the size of the RAM space as a log ring buffer directly affects the amount of data storage of the RAID card firmware running, the detail level of data records, and has a significant impact on the product's fault analysis and event tracing. If the capacity of RAM and Flash can be increased and the capacity of data storage can be increased, it will have a positive effect on promoting the improvement of product quality and product performance. Therefore, an optional embodiment of the present application defines a method for storing logs in a RAID card. This method is a method for storing information such as logs and data of a RAID card that uses NVMe protocol communication, and achieves the purpose of expanding the storage space of logs and data without increasing hardware costs.

[0118] Among them, the Host Memory Buffer (HMB feature) in the NVMe protocol is a mechanism that enables the host to allocate a portion of the host memory for exclusive use by the controller, that is, the host can provide a piece of free memory for use by the NVMe device connected to it.

[0119] Figure 5 is a schematic diagram of a method for storing logs in a RAID card according to an optional embodiment of the present application, such as Figure 5 As shown in the figure, the RAID card and the host also use PCle to connect the PCle endpoint on the RAID card and the Rootcomplex in the host, and the uart is connected to the debugging RC through the serial port line. It is not necessary to build a circular buffer in the RAM of the RAID card, nor is it necessary to transfer data to the host through Flash. Instead, a circular buffer 2 is created in the Double Data Rate Synchronous Dynamic Random Access Memory (DDR) in the host. The data corresponding to the CPU in the host can be directly transferred to the circular buffer 2 in the host, and then the host transfers the data in the circular buffer to the hard disk.

[0120] Figure 6 is a flow chart of a method for storing logs in a RAID card according to an optional embodiment of the present application. Figure 6 As shown, specifically including:

[0121] Step S601, establishing a PCle communication link.

[0122] After the RAID card is powered on, the RAID card establishes a communication link with the host as a PCIe endpoint and uses the NVMe protocol for communication.

[0123] Step S602, the host sends NVMe request information to confirm the attributes and capability set of the RAID card; at the same time, the RAID card receives, parses, and responds to the NVMe request information sent by the host.

[0124] The host interacts with the RAID card to obtain the RAID card attribute information, that is, basic information (for example, identification information of the RAID card, etc.) and supported capability sets.

[0125] Step S603: determine whether the RAID card supports the HMB feature.

[0126] That is, it is confirmed whether the RAID card supports data transmission through the HMB feature (ie, the host memory buffer feature of the present application). If it is determined that the HMB feature is supported, the host executes step S604, and if it is determined that the HMB feature is not supported, the process ends.

[0127] Step S604: the host allocates a free memory block as HMB dedicated memory for use by the RAID card.

[0128] After determining that the RAID card supports the HMB feature (i.e., the host memory buffer feature of this application) in the capability set supported by the RAID card, the host allocates a piece of free memory (the free space is the memory space of this application, and its capacity is much larger than the RAM capacity of the RAID card) as exclusive memory for use by the RAID card.

[0129] Step S605: The host sends an NVMe request message (ie, the enable instruction of this application) to the RAID card to enable the HMB feature of the RAID card.

[0130] The host interacts with the RAID card, enables the HMB feature of the RAID card, and provides the RAID card with information such as the first address and memory capacity of the dedicated memory.

[0131] Step S606: The RAID card receives, parses, and responds to the HMB feature enable message sent by the host.

[0132] The RAID card receives the HMB feature enable message sent by the host, obtains the first address and memory capacity information of the dedicated memory, and replies with a response message.

[0133] Step S607, the log management module in the RAID card is initialized, and a ring buffer is established using the HMB dedicated memory, which is equivalent to establishing the HMB feature in the HMB dedicated memory of the host's DDR.

[0134] During the initialization of the RAID card log management module, a log storage buffer is established based on the first address of the exclusive memory provided by the host, and managed in a circular buffer. The circular buffer has producer and consumer identifiers, which respectively identify the end and start positions of data storage in the buffer.

[0135] Step S608, the business module calls the log management module application programming interface (Application Programming Interface, referred to as API) to write data, and then caches the data into the ring buffer area and updates the producer identifier.

[0136] When the RAID card business module outputs data, it calls the API provided by the log management module to output the data to the ring buffer, and notifies the host to update the producer ID through the asynchronous event message in the NVMe protocol to indicate that new data has been generated.

[0137] Step S609, determine whether to store the data. If it is determined that the data is to be stored, execute step S510; if it is determined that the data is not to be stored, execute step S508.

[0138] The task run by the log management module notifies the host to start reading data from the consumer identifier of the ring buffer at intervals and update the consumer identifier (that is, the role of the update information of this application).

[0139] Step S610, calling the log management module API to store the data to the hard disk, that is, the host reads the data from the circular buffer area and updates the consumer identifier to write the data to the corresponding hard disk.

[0140] The host stores the read data in its hard disk for subsequent RAID card fault analysis and event tracking.

[0141] In summary, the optional embodiment of the present application expands the RAM space available to the RAID card through the HMB feature, thereby greatly increasing the capacity of the log buffer, improving the storage capacity of the log and the integrity of the data storage, and facilitating subsequent problem analysis. At the same time, when the host exports data, it can be read directly from the HMB, reducing the interaction process between the host and the RAID card, avoiding the process of first reading data from the Flash of the RAID card and then transmitting it to the host in batches, and improving the execution efficiency of the host exporting data.

[0142] That is, an optional embodiment of the present application proposes a method for storing logs, data and other content of a RAID card that adopts NVMe protocol communication. Through the HMB feature, the host's free memory is used as the log buffer of the RAID card to expand the original log buffer, thereby achieving the purpose of increasing the log storage capacity, reducing the risk of log buffer overflow, and saving the hardware cost of the RAID card.

[0143] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0144] In the present embodiment, a construction system of a ring buffer is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0145] Figure 7 is a structural block diagram of a system for constructing a ring buffer according to an embodiment of the present application, such as Figure 7 As shown, the system includes:

[0146] The host 72 is used to determine whether the RAID card supports the host memory buffer feature; if it is determined that the RAID card supports the host memory buffer feature, allocate memory space for the RAID card and send an enable instruction to the RAID card;

[0147] The RAID card 74 is used to construct a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics when receiving the enable instruction sent by the host, wherein the circular buffer area is used to store the data in the RAID card.

[0148] Through the construction system of the circular buffer area of ​​the present application, it is determined whether the RAID card supports the host memory buffer feature. When it is determined that the RAID card supports the host memory buffer feature, memory space is allocated to the RAID card. An enable instruction is sent to the RAID card so that the RAID card constructs a circular buffer area in the memory space for storing the data written to the host by the RAID card according to the enable instruction and the host memory buffer feature. In other words, when it is determined that the RAID card has the host memory buffer feature, the embodiment of the present application constructs a circular buffer area in the host through the host memory buffer feature of the RAID card, thereby solving the problem of insufficient data storage capacity caused by limited hardware resources for the operation of the RAID card firmware in the related art. And then expand the data storage capacity.

[0149] In an exemplary embodiment, the host 72 is further used to establish a communication link with the RAID card based on a target protocol; obtain a capability set supported by the RAID card according to the communication link; and determine whether the RAID card supports the host memory buffer feature according to the capability set.

[0150] In an exemplary embodiment, the host 72 is also used to determine the target space amount of the first data and the first remaining space amount of the circular buffer area when receiving the first data written by the RAID card; compare the first size relationship between the target space amount and the first remaining space amount; and instruct the RAID card to write the first data to the circular buffer area according to the first size relationship.

[0151] In an exemplary embodiment, the host 72 is also used to instruct the RAID card to write the first data to the circular buffer area when the first size relationship indicates that the target space amount is less than or equal to the first remaining space amount; determine the priority of the data in the circular buffer area when the first size relationship indicates that the target space amount is greater than the first remaining space amount; delete the second data in the circular buffer area according to the priority, and update the remaining space amount of the circular buffer area from the first remaining space amount to the second remaining space amount; compare the second size relationship between the target space amount and the second remaining space amount; and instruct the RAID card to write the first data to the circular buffer area when the second size relationship indicates that the target space amount is less than or equal to the second remaining space amount.

[0152] In an exemplary embodiment, the host 72 is further configured to determine a write time of each data in the circular buffer area; and determine a priority of each data in the circular buffer area according to multiple write times.

[0153] In an exemplary embodiment, the host 72 is also used to determine whether the first data is allowed to be written to the solid-state drive; if it is determined that the first data is allowed to be written to the solid-state drive, determine whether the priority of the first data in the circular buffer area is the highest priority; if it is determined that the priority corresponding to the first data is the highest priority, write the first data to the solid-state drive.

[0154] In an exemplary embodiment, the host 72 is also used to parse the first data to obtain a first check code corresponding to the first data, and to obtain a second check code corresponding to the first data, wherein the second check code is a check code determined by the RAID card based on a target algorithm and the first data; the first check code and the second check code are compared; when the comparison result indicates that the first check code and the second check code are consistent, it is determined that the first data is complete, and the first data is allowed to be written to the ring buffer area.

[0155] In an exemplary embodiment, the RAID card 74 is also used to construct a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics when receiving an enable instruction sent by the host, wherein the host is used to: determine whether the RAID card supports the host memory buffer characteristics; when it is determined that the RAID card supports the host memory buffer characteristics, allocate memory space to the RAID card and send the enable instruction to the RAID, and the circular buffer area is used to store data in the RAID card.

[0156] In an exemplary embodiment, the RAID card 74 is also used to determine whether the first address and the first memory capacity sent by the host are received, wherein the first memory capacity is the memory capacity of the memory space, and the first address is the first address corresponding to the memory space; when it is determined that the first address and the first memory capacity are received, the memory buffer feature is enabled according to the enable instruction, and the circular buffer area is established in the memory space based on the first address, wherein the second memory capacity of the circular buffer area is less than or equal to the first memory capacity.

[0157] In an exemplary embodiment, the RAID card 74 is also used to set a producer identifier and a consumer identifier in the circular buffer area, wherein the producer identifier is used to indicate the starting position of the data in the circular buffer area, and the consumer identifier is used to indicate the ending position of the data in the circular buffer area; the producer identifier and the consumer identifier are sent to the host so that the host manages the data in the circular buffer area.

[0158] In an exemplary embodiment, the RAID card 74 is further used to send update information to the host based on the target protocol when writing the third data to the circular buffer area, so that the host updates the producer identifier and the consumer identifier according to the update information.

[0159] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0160] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0161] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:

[0162] S1, determine whether the RAID card supports the host memory buffer feature;

[0163] S2, allocating memory space to the RAID card when it is determined that the RAID card supports the host memory buffer feature;

[0164] S3, sending an enable instruction to the RAID card, so that the RAID card constructs a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics, wherein the circular buffer area is used to store data written by the RAID card to the host.

[0165] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in the above method embodiment.

[0166] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0167] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0168] S1, determine whether the RAID card supports the host memory buffer feature;

[0169] S2, allocating memory space to the RAID card when it is determined that the RAID card supports the host memory buffer feature;

[0170] S3, sending an enable instruction to the RAID card, so that the RAID card constructs a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics, wherein the circular buffer area is used to store data written by the RAID card to the host.

[0171] An embodiment of the present application further provides a computer program product, including a computer program, which is implemented to perform the steps in the above method embodiment when executed by a processor.

[0172] Optionally, in this embodiment, the computer program product may be executed by a processor to perform the following steps:

[0173] S1, determine whether the RAID card supports the host memory buffer feature;

[0174] S2, allocating memory space to the RAID card when it is determined that the RAID card supports the host memory buffer feature;

[0175] S3, sending an enable instruction to the RAID card, so that the RAID card constructs a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics, wherein the circular buffer area is used to store data written by the RAID card to the host.

[0176] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0177] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0178] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for constructing a ring buffer, characterized in that: Applied to the host, include: Determine whether the RAID card supports the host memory buffer feature; In the case of determining that the RAID card supports the host memory buffer feature, allocating memory space to the RAID card; An enable instruction is sent to the RAID card, so that the RAID card constructs a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristic, wherein the circular buffer area is used to store data written by the RAID card to the host.

2. The method according to claim 1, characterized in that Determine whether the RAID card supports the host memory buffer feature, including: Establishing a communication link with the RAID card based on a target protocol; Acquire a capability set supported by the RAID card according to the communication link; Determine whether the RAID card supports the host memory buffer feature according to the capability set.

3. The method according to claim 1, characterized in that After sending an enable instruction to the RAID card so that the RAID card constructs a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristic, the method further includes: Upon receiving the first data written by the RAID card, determining a target space amount of the first data and a first remaining space amount of the ring buffer; comparing a first size relationship between the target space amount and the first remaining space amount; The RAID card is instructed to write the first data into the ring buffer area according to the first size relationship.

4. The method according to claim 3, characterized in that Instructing the RAID card to write the first data into the ring buffer area according to the first size relationship includes: In a case where the first size relationship indicates that the target space amount is less than or equal to the first remaining space amount, instructing the RAID card to write the first data into the ring buffer area; determining the priority of the data in the ring buffer if the first size relationship indicates that the target amount of space is greater than the first amount of remaining space; Deleting the second data of the circular buffer area according to the priority, and updating the remaining space amount of the circular buffer area from the first remaining space amount to the second remaining space amount; comparing a second size relationship between the target space amount and the second remaining space amount; When the second size relationship indicates that the target space amount is less than or equal to the second remaining space amount, the RAID card is instructed to write the first data into the ring buffer area.

5. The method according to claim 4, characterized in that Determining the priority of the data in the ring buffer includes: Determine the writing time of each data in the circular buffer area; The priority of each data in the ring buffer is determined according to a plurality of write times.

6. The method according to claim 3, characterized in that: After instructing the RAID card to write the first data into the ring buffer area according to the first size relationship, the method further includes: determining whether to allow the first data to be written to the solid state drive; In the case where it is determined that the first data is allowed to be written into the solid state drive, determining whether the priority of the first data in the ring buffer area is the highest priority; When it is determined that the priority corresponding to the first data is the highest priority, the first data is written to the solid state drive.

7. The method according to claim 3, characterized in that Before instructing the RAID card to write the first data into the ring buffer area according to the first size relationship, the method further includes: Parsing the first data to obtain a first check code corresponding to the first data, and obtaining a second check code corresponding to the first data, wherein the second check code is a check code determined by the RAID card based on a target algorithm and the first data; Comparing the first verification code with the second verification code; When the comparison result indicates that the first verification code is consistent with the second verification code, it is determined that the first data is complete, and the first data is allowed to be written into the ring buffer.

8. A method for constructing a ring buffer, characterized in that: Applied to RAID card, include: When an enable instruction is received from a host, a circular buffer area is constructed in a memory space according to the enable instruction and the host memory buffer characteristic, wherein the host is used to: determine whether the RAID card supports the host memory buffer characteristic; when it is determined that the RAID card supports the host memory buffer characteristic, allocate memory space to the RAID card and send the enable instruction to the RAID, wherein the circular buffer area is used to store data in the RAID card.

9. The method according to claim 8, characterized in that Constructing a circular buffer area in the memory space according to the enabling instruction and the host memory buffer characteristics, including: Determine whether the first address and the first memory capacity sent by the host are received, wherein the first memory capacity is the memory capacity of the memory space, and the first address is the first address corresponding to the memory space; When it is determined that the first address and the first memory capacity are received, the memory buffer feature is enabled according to the enable instruction, and the circular buffer area is established in the memory space based on the first address, wherein the second memory capacity of the circular buffer area is less than or equal to the first memory capacity.

10. The method according to claim 8, characterized in that After constructing a ring buffer in the memory space according to the enable instruction and the host memory buffer characteristics, the method further includes: Setting a producer identifier and a consumer identifier in the circular buffer, wherein the producer identifier is used to indicate a starting position of data in the circular buffer, and the consumer identifier is used to indicate an ending position of data in the circular buffer; The producer identifier and the consumer identifier are sent to the host so that the host manages the data in the ring buffer.

11. The method according to claim 10, characterized in that After sending the producer identifier and the consumer identifier to the host, the method further comprises: When the third data is written into the ring buffer area, update information is sent to the host based on the target protocol, so that the host updates the producer identifier and the consumer identifier according to the update information.

12. A system for constructing a ring buffer, characterized in that: include: The host is used to determine whether the RAID card supports the host memory buffer feature; if it is determined that the RAID card supports the host memory buffer feature, allocate memory space to the RAID card and send an enable instruction to the RAID card; The RAID card is used to construct a circular buffer area in the memory space according to the enable instruction and the host memory buffer characteristics when receiving the enable instruction sent by the host, wherein the circular buffer area is used to store the data in the RAID card.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method of any one of claims 1 to 7 or claims 8 to 11 when executed by a processor.

14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 or claims 8 to 11 are implemented.

15. A computer program product comprising a computer program, characterized in that The computer program is used by a processor to execute the steps of the method described in any one of claims 1 to 7 or claims 8 to 11.

Citation Information

Patent Citations

  • Method and system for storing user operation data and receiving terminal of digital television

    CN102469357A

  • Data writing method, apparatus and device of ring buffer, and medium

    CN108491333A

  • SAS card firmware log collection method, system and device and storage medium

    CN111240879A

  • Inter-thread lock-free log management method and system, terminal and storage medium

    CN111416825A

  • Method and system for repairing inconsistent stripe data in RAID

    CN113626248A

Cited By

  • Firmware upgrading method and system, server, equipment, medium and product

    CN120122972A

  • Firmware upgrade method, system, server, device, medium and product

    CN120122972B