Self-adaptive disk formatting method and device for RAID (redundant array of independent disks) card

By parsing the unified formatting command of the RAID card and converting it into the native formatting command of the target disk protocol, the problem of complex formatting operations for extended disks on RAID cards is solved, adaptive formatting is achieved, and storage management efficiency and compatibility are improved.

CN120950003APending Publication Date: 2025-11-14JINAN MAIWEI INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511195150.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

In existing technologies, the disk formatting scheme for RAID card expansion requires users to manually identify the disk type and configuration parameters, which makes the operation complex and error-prone, and cannot adapt to multi-type disk scenarios.

Method used

The RAID card receives and parses the unified formatting command, queries the pre-stored disk information table, converts it into the native formatting command of the target disk's corresponding protocol, and ensures that the logical block address size remains unchanged, while asynchronously obtaining the execution result.

Benefits of technology

It enables RAID cards to adaptively format extended disks without requiring users to pay attention to specific disk information, improving storage management efficiency and compatibility, lowering the operational threshold, and enhancing the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120950003A_ABST
    Figure CN120950003A_ABST
Patent Text Reader

Abstract

The invention relates to the field of disk formatting, in particular to a self-adaptive disk formatting method and device for an RAID card, and the method comprises the steps: receiving and analyzing a unified formatting command, querying a disk information table, obtaining a protocol type of a target disk, converting the unified formatting command into a native formatting command of a protocol corresponding to the target disk, and sending the native formatting command to a server; and issuing the converted native formatting command to the target disk for execution. According to the embodiment of the invention, the unified formatting command is independently received and analyzed through the RAID card, independent formatting management of the RAID card on the extended disk is realized without depending on a host to participate in disk identification and protocol judgment, and a user can complete operation without paying attention to specific information of the disk, so that the storage management efficiency and compatibility are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of disk formatting technology, and more specifically to an adaptive disk formatting method and apparatus for RAID cards. Background Technology

[0002] With the rapid development of technologies such as big data, the amount of data is growing explosively, and the demand for data transmission and storage performance of data center servers is increasing day by day. At present, expanding the connection of disks with different protocols through Redundant Arrays of Independent Disks (RAID) cards has become the mainstream method to meet diverse storage needs.

[0003] However, existing disk formatting solutions have significant limitations: current tools rely on the operating system to directly identify the disk and require users to explicitly know the disk type, protocol version, and other information to configure different formatting parameters, making them unsuitable for scenarios involving multiple disk types expanded by RAID cards. Therefore, how to achieve adaptive formatting of disks expanded by RAID cards, allowing users to complete the operation without needing to know the specific disk information, thereby improving storage management efficiency and compatibility, has become a problem that needs to be solved. Summary of the Invention

[0004] In view of this, this disclosure provides an adaptive disk formatting method and apparatus for RAID cards to solve the problem of how to achieve adaptive formatting of extended disks of RAID cards, allowing users to complete the operation without paying attention to the specific information of the disk, thereby improving storage management efficiency and compatibility.

[0005] This disclosure provides an adaptive disk formatting method for a RAID card, the method comprising:

[0006] Receive and parse the uniform formatting command issued by the host, and obtain the unique identifier, command identifier and formatting type contained in the uniform formatting command; among them, the unique identifier is used to index the target disk, and the command identifier is used to identify that the uniform formatting command is a disk formatting command; the formatting type includes one of the following: quick format, normal format or query formatting progress;

[0007] The target disk's protocol type and formatting support features are obtained by querying the pre-stored disk information table based on the unique identifier; the disk information table includes at least the logical block address size, protocol type, and supported formatting command capabilities of each disk.

[0008] Based on the protocol type and formatting support characteristics, the unified formatting command is converted into the native formatting command of the target disk corresponding to the protocol;

[0009] The converted native formatting command is sent to the target disk for execution, and the logical block address size of the target disk remains unchanged before and after formatting.

[0010] The formatting results of the target disk are obtained asynchronously and then fed back to the host.

[0011] This disclosure also provides an adaptive disk formatting apparatus for a RAID card, the apparatus comprising:

[0012] The command acquisition module is used to receive and parse the uniform formatting command issued by the host, and obtain the unique identifier, command identifier and formatting type contained in the uniform formatting command; among them, the unique identifier is used to index the target disk, and the command identifier is used to identify that the uniform formatting command is a disk formatting command; the formatting type includes one of the following: quick format, normal format or query formatting progress;

[0013] The information query module is used to query the pre-stored disk information table based on the unique identifier to obtain the protocol type and formatting support features of the target disk; wherein, the disk information table includes at least the logical block address size, protocol type and supported formatting command capabilities of each disk;

[0014] The command conversion module is used to convert uniform formatting commands into native formatting commands for the target disk's corresponding protocol, based on the protocol type and formatting support characteristics.

[0015] The command delivery module is used to deliver the converted native formatting command to the target disk for execution, and to ensure that the logical block address size of the target disk remains unchanged before and after formatting.

[0016] The result feedback module is used to asynchronously obtain the formatting execution result of the target disk and send it back to the host.

[0017] This disclosure also provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the above-described adaptive disk formatting method for a RAID card.

[0018] This disclosure also provides a computer-readable storage medium storing computer instructions for causing a computer to implement the aforementioned adaptive disk formatting method for a RAID card.

[0019] This disclosure also provides a computer program product including computer instructions for causing a computer to perform the aforementioned adaptive disk formatting method for a RAID card.

[0020] The adaptive disk formatting method and apparatus for RAID cards disclosed in the above embodiments enable the RAID card to independently receive and parse unified formatting commands without relying on the host for disk identification and protocol judgment. This allows the RAID card to autonomously format and manage extended disks, enabling users to complete operations without needing to pay attention to specific disk information, thereby improving storage management efficiency and compatibility.

[0021] In addition, users only need to issue a unified formatting command, without having to pay attention to the details of the disk protocol, which greatly reduces the user's operating threshold and improves the user experience. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of this disclosure, the accompanying drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a schematic diagram of a RAID card expansion connection architecture provided in an embodiment of the present disclosure;

[0024] Figure 2 This is a flowchart illustrating an adaptive disk formatting method for a RAID card provided in an embodiment of this disclosure;

[0025] Figure 3 This is a schematic diagram of a unified formatting command format for an adaptive disk formatting method for a RAID card provided in an embodiment of this disclosure;

[0026] Figure 4 This is a schematic flowchart of an adaptive disk formatting method for a RAID card provided in an embodiment of this disclosure;

[0027] Figure 5 This is a schematic diagram of an adaptive disk formatting device for a RAID card provided in an embodiment of this disclosure;

[0028] Figure 6 This is a schematic diagram of another adaptive disk formatting device for a RAID card provided in an embodiment of this disclosure. Detailed Implementation

[0029] With the rapid development of technologies such as big data, the amount of data is growing explosively, and the demand for data transmission and storage performance of data center servers is increasing day by day. To meet this demand, solid-state drives (SSDs) based on the Non-Volatile Memory Express (NVMe) protocol, hard disk drives (HDDs) based on the Serial Advanced Technology Attachment (SATA) protocol, and HDDs based on the Serial Attached SCSI protocol have emerged on the market.

[0030] For today's increasingly complex application systems, which need to meet both large-scale data storage requirements and high-performance storage scenarios, simply connecting servers directly to disks is no longer sufficient to meet these diverse needs. Therefore, such as Figure 1 As shown, the industry commonly uses RAID cards to expand the connection of different types of disks to flexibly meet the storage needs of different application scenarios. Figure 1 In this setup, the host connects to the RAID card, which in turn connects to SATA, SAS, and NVMe disks respectively.

[0031] In addition, disks need to be formatted before use or when data needs to be erased. Currently, different operating systems have relatively mature formatting tools for disks directly connected to the host or server, but these tools have significant limitations:

[0032] On the one hand, the server operating system needs to directly recognize the disk; otherwise, it cannot perform formatting operations through tools. However, disks expanded by RAID cards are often not directly recognized by the operating system, causing tools to fail.

[0033] On the other hand, users need to know the specific type and version of the disk in advance, and configure different formatting parameters for different disks. The operation is complicated and formatting may fail due to incorrect parameter configuration.

[0034] To address the aforementioned issues, various embodiments of this disclosure provide an adaptive disk formatting method for a RAID card. The method includes: receiving and parsing a unified formatting command issued by a host, and obtaining a unique identifier, a command identifier, and a formatting type contained in the unified formatting command; wherein the unique identifier is used to index the target disk, and the command identifier is used to characterize the unified formatting command as a disk formatting command; the formatting type includes one of the following: quick format, normal format, or querying formatting progress; querying a pre-stored disk information table based on the unique identifier to obtain the protocol type and formatting support characteristics of the target disk; wherein the disk information table includes at least the logical block address size, protocol type, and supported formatting command capabilities of each disk; converting the unified formatting command into a native formatting command corresponding to the protocol of the target disk based on the protocol type and formatting support characteristics; issuing the converted native formatting command to the target disk for execution, ensuring that the logical block address size of the target disk remains unchanged before and after formatting; asynchronously obtaining the formatting execution result of the target disk and feeding it back to the host.

[0035] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0036] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating an adaptive disk formatting method for a RAID card provided in this disclosure embodiment. The method may include the following steps:

[0037] Step S201: Receive and parse the uniform formatting command issued by the host, and obtain the unique identifier, command identifier and formatting type contained in the uniform formatting command.

[0038] In this embodiment, the RAID card is a disk array card, specifically used to combine multiple physical disks into a virtual single large-capacity disk through a RAID controller, so as to provide the host with higher storage performance than a single physical disk.

[0039] A host can refer to a server in a data center, the source of instructions that initiate disk formatting operations, or a terminal that receives the execution results.

[0040] Specifically, the RAID card acts as an intermediate control unit connecting the host and various types of disks. The host sends a unified formatting command to the RAID card through the management interface, without needing to directly identify or manage the hard drives of different protocol types linked by the RAID card. After the RAID card completes the formatting process, the host receives the execution result from the RAID card.

[0041] The RAID card connects to the host via the high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCIe) and receives unified formatting commands from the host.

[0042] Here, the unified formatting commands issued by the host conform to the standard NVMe command format. The unified formatting command includes a unique identifier, a command identifier, and a formatting type.

[0043] Among them, the unique identifier is a unique identifier for a disk and is used to index the target disk, that is, to index the hard drive that needs to be formatted.

[0044] The command identifier represents the operation code (OP code) of the uniform formatting command, which is used to identify the uniform formatting command as a disk formatting command.

[0045] The OP code can be 1 byte in size and serves as the identity representation of the NVMe command, informing the disk of the operation type of this command.

[0046] As an example, the command identifier can be a specific OP code value selected from the vendor-specific range reserved for vendors by the NVMe protocol, used to identify the custom command for disk formatting under the RAID card. For example, the OP code can be 0xFD.

[0047] As another example, the format of a uniform formatting command issued by the host can be as follows: Figure 3 As shown, Figure 3 This is a schematic diagram of a unified formatting command format for an adaptive disk formatting method for a RAID card, provided in an embodiment of this disclosure, wherein:

[0048] The uniform formatting command can be split into 16 double words (i.e., DW0-DW15, each double word is 32 bits).

[0049] In DW0, the lower 8 bits (bits 0-7) are 0xFD (i.e., the command identifier mentioned above); the higher 24 bits are CommandIdentifier (i.e., format type, used to distinguish different commands of the same type) and Reserved (reserved bits, not used for now).

[0050] In DW1, the lower 16 bits are 0x0 (reserved or a specific identifier; here, it's set to 0 as needed), and the higher 16 bits are Reserved. In DW2, part of the space stores format_opt (the format type), and the other part stores pdid (the unique identifier). In DW3-DW15, these are set to Reserved for future use.

[0051] Furthermore, the formatting type includes one of the following: quick format, normal format, or query formatting progress.

[0052] Quick format is defined as a formatting method that only initializes and clears the disk's file system metadata (such as partition tables and boot records), without checking for bad sectors sector by sector or completely overwriting the original data on the disk. Normal format is defined as a formatting method that not only clears the file system metadata but also checks for bad sectors sector by sector, and in some scenarios, may initially overwrite the original data on the disk. Querying formatting progress is defined as an operation type that does not perform a formatting operation on the disk but only initiates a formatting execution status query to the RAID card or target disk to obtain the current formatting operation completion percentage, remaining time, and other execution results.

[0053] Step S202: Query the pre-stored disk information table based on the unique identifier to obtain the protocol type and formatting support characteristics of the target disk.

[0054] In this embodiment, the disk information table is a pre-built information carrier for the RAID card, used to uniformly store and manage the key attributes of all extended disks. The disk information table includes at least the logical block address (LBA) size (hereinafter referred to as LBA_size), protocol type, and supported formatting command capabilities of each disk.

[0055] Specifically, the disk information table includes, but is not limited to: unique identifier, protocol type, formatting support features, LBA_size, and other formatting parameters.

[0056] The unique identifier is a unique identifier for each disk, which is completely consistent with the unique identifier in the unified formatting command issued by the host, and is used to uniquely index the target disk.

[0057] For example, if the unique identifier of an NVMe hard drive in the disk information table is 01, the unique identifier of a SATA hard drive is 02, and the unique identifier in the uniform format command is 01, then the target disk corresponding to the uniform format command is an NVMe hard drive.

[0058] The protocol type refers to the storage interface protocol used by the disk. Protocol types include, but are not limited to, NVMe, SATA, and SAS protocols. The formatting support feature indicates the types of formatting commands supported by the disk. This can be used to determine whether the formatting type issued by the host is compatible with the disk, in order to avoid command conversion failures.

[0059] LBA_size is the size of the disk's logical blocks (or sectors). Other formatting parameters are supplementary parameters related to formatting, used to configure and enhance the native formatting command.

[0060] Furthermore, based on the unique identifier in the unified formatting command, the disk information table is matched, the disk matching the unique identifier is taken as the target disk, and the protocol type and formatting support characteristics of the target disk are obtained.

[0061] Step S203: Based on the protocol type and formatting support characteristics, convert the unified formatting command into the native formatting command corresponding to the target disk's protocol.

[0062] In this embodiment, if the target disk's protocol type is NVMe, then the unified format command is converted into the native format command of the NVMe protocol.

[0063] If the target disk uses the SATA protocol, the unified format command will be converted to the native format command for the SATA protocol.

[0064] If the target disk uses the SAS protocol, the uniform formatting command will be converted to the native formatting command of the SAS protocol.

[0065] Specifically, the native formatting commands for the NVMe protocol are formatting instructions based on the NVMe protocol specification that can be directly parsed and executed by NVMe disks. Similarly, the native formatting commands for the SATA protocol are formatting instructions based on the SATA protocol specification that can be directly parsed and executed by SATA disks. Likewise, the native formatting commands for the SAS protocol are formatting instructions based on the SAS protocol specification that can be directly parsed and executed by SAS disks.

[0066] Step S204: Send the converted native formatting command to the target disk for execution, and ensure that the logical block address size of the target disk remains unchanged before and after formatting.

[0067] In this embodiment, based on the protocol type of the target disk, the corresponding delivery method is determined, and the native formatting command is delivered to the target disk using the corresponding delivery method, so that the target disk executes the native formatting command of the corresponding protocol.

[0068] In one possible implementation, ensuring that the LBA_size of the target disk remains unchanged before and after formatting may include: during the conversion process of the native formatting command as shown in step S203, the LBA_size extracted from the disk information table is used as a fixed value, and during the conversion process, this fixed value is only filled into the corresponding field of the native command and is not allowed to be modified.

[0069] Here, we ensure that LBA_size remains unchanged before and after formatting to avoid the target disk becoming unusable after formatting due to changes in LBA_size.

[0070] Step S205: Asynchronously obtain the formatting execution result of the target disk and send it back to the host.

[0071] In this embodiment, after the RAID card issues the native format command, it does not need to continuously occupy resources to wait for the disk to respond. Instead, it actively obtains the format execution result after the disk has completed formatting through a preset asynchronous receiving mechanism, and organizes the format execution result into a form that the host can recognize and then feeds it back.

[0072] As an example, the formatting execution result may include a basic execution status and optional supplementary information. The basic execution status may include whether formatting was successful or failed.

[0073] If the formatting type is query formatting progress, the supplementary information may include, but is not limited to, progress data such as completion percentage and remaining completion time.

[0074] The adaptive disk formatting method and apparatus for RAID cards disclosed in the above embodiments allow the host to issue only one unified formatting command. The RAID card independently receives and parses the unified formatting command, eliminating the need for the host to participate in disk identification and protocol judgment. This enables the RAID card to autonomously format and manage extended disks, allowing users to complete operations without needing to pay attention to specific disk information, thereby improving storage management efficiency and compatibility. The RAID card automatically queries the disk information table and completes command conversion according to protocol type and supported features. Users do not need to pay attention to disk protocol details, greatly reducing the user's operational threshold and improving the user experience. After issuing the command, the RAID card does not need to wait continuously; it actively returns the result after the disk execution is completed, avoiding resource waste and adapting to multi-disk parallel formatting scenarios.

[0075] In one possible implementation of step S202 above, the pre-stored disk information table is constructed based on the following steps:

[0076] When initializing or inserting a new disk, send information retrieval commands to each disk and receive response information returned by each disk based on the information retrieval commands;

[0077] Parse the response information to obtain the protocol type, formatting support features, logical block address size, and other formatting parameters for each disk; among which, the protocol type includes, but is not limited to: NVMe protocol, SATA protocol, or SAS protocol;

[0078] The disk information table is constructed by associating and storing the protocol type, formatting support features, logical block address size, and other formatting parameters of each disk with the unique identifier of the corresponding disk.

[0079] In this embodiment, provided that the RAID card has completed its own hardware initialization, when the system is in the processing stage or a new disk is inserted, an information retrieval command is generated and sent to each disk.

[0080] When a new disk is inserted through the disk interface of the RAID card, the RAID card can detect the disk connection through hardware signals.

[0081] Specifically, the RAID card can initially determine the possible protocol type of the disk through the physical interface of the disk connection, generate information acquisition instructions for the corresponding protocol, and send the information acquisition instructions to the disk through the communication link of the corresponding protocol.

[0082] Here, after the disk parses and executes the information retrieval command, it returns response information containing its own attributes through the response mechanism of the corresponding protocol. The RAID card receives the response information and temporarily stores it.

[0083] Furthermore, the received response information is parsed according to the protocol, the core fields required to build the disk information table are extracted, the core fields are associated with unique identifiers, and written (or updated) into the pre-stored disk information table.

[0084] If the disk is a newly inserted disk, a new record is added to the disk information table; if the disk is an existing disk, the record in the disk information table is verified to be consistent with the newly acquired information. If they are inconsistent, the disk information table is updated.

[0085] The adaptive disk formatting method and apparatus for RAID cards disclosed in the above embodiments advance the disk information acquisition step, completing information collection and storage during initialization or new disk insertion. Subsequent processing of formatting commands eliminates the need for real-time interaction with the disk to query information; instead, a local disk information table is consulted, reducing command processing latency and accelerating the overall formatting process. By uniformly converting response information from disks using different protocols into standardized fields in the disk information table, the logical complexity of multi-protocol management is reduced, thereby improving the compatibility of the initialization process.

[0086] In one possible implementation of the above embodiments, before step S203, the method further includes:

[0087] Determine whether the formatting type in the uniform formatting command matches the formatting support features of the target disk;

[0088] If a match is found, the unified formatting command will be converted into the native formatting command of the target disk's corresponding protocol, based on the protocol type and formatting support features.

[0089] If a mismatch occurs, a formatting error message will be generated and sent back to the host.

[0090] In this embodiment, the format type is obtained from the uniform format command, and the format support characteristics of the target disk are obtained from the disk information table; the format type and the format support characteristics are compared to determine whether the target disk supports the format operation required by the host.

[0091] For example, if the host requires quick formatting, check if the target disk supports quick formatting.

[0092] Based on the comparison results, the following cases are handled:

[0093] If a match is found, the unified formatting command will be converted into the native formatting command of the target disk's corresponding protocol, based on the protocol type and formatting support features.

[0094] If there is a mismatch, the generated prompt message will be returned to the host through the feedback mechanism of step S205 above, and the subsequent formatting process will be terminated.

[0095] For example, the prompt message could be that the target disk does not support the current format type.

[0096] The adaptive disk formatting method and apparatus for RAID cards disclosed in the above embodiments can identify mismatches early in the process by comparing the formatting type with the disk's supported features before command conversion. This avoids issuing invalid native commands and disk execution failures, reducing the waste of communication resources between the RAID card and the disk. Command conversion is only performed when the formatting type matches, ensuring that subsequent native formatting commands are fully compatible with disk capabilities. This avoids risks such as disk response anomalies and data corruption caused by forcibly executing unsupported operations, further improving the stability and security of the formatting process.

[0097] In one possible implementation of step S203 above, the unified formatting command is converted into the native formatting command of the target disk's corresponding protocol based on the protocol type and formatting support characteristics, including:

[0098] If the target disk's protocol type is NVMe, query the disk information table for the target disk's formatting support characteristics, and determine the type of native formatting command for the target disk based on the formatting support characteristics;

[0099] If the native formatting command for the target disk is the NVMe admin format command, extract the logical block address size of the target disk from the disk information table, as well as the Format NVM Attributes from other formatting parameters;

[0100] Fill the logical block address size into the LBA field of the NVMe protocol's commit queue entry, fill the Format NVMAttributes field of the commit queue entry, and configure the command opcode field of the commit queue entry to the opcode corresponding to the NVMe admin format command specified by the NVMe protocol, thereby generating the NVMeadmin format native formatting command.

[0101] If the native formatting command for the target disk is the NVMe IO Dataset Management command, extract the logical block address size of the target disk and the disk capacity information from other formatting parameters from the disk information table;

[0102] Fill the logical block address size into the LBA field of the submission queue entry, fill the disk capacity information into the capacity-related field of the submission queue entry, and configure the command opcode field of the submission queue entry to the opcode corresponding to the NVMeIO Dataset Management command specified by the NVMe protocol to generate the NVMe IO Dataset Management native formatting command;

[0103] The generated NVMe admin format or NVMe IO Dataset Management native format command corresponding to the commit queue entry is placed into the commit queue of the target disk, and a notification signal is written to the doorbell register of the target disk so that the target disk reads the commit queue entry based on the notification signal.

[0104] In this embodiment, if the target disk's protocol type is NVMe, the formatting support characteristics of the target disk are queried from the disk information table, and the type of the target disk's native formatting command is determined based on the formatting support characteristics, including:

[0105] Query the disk information table to determine the formatting support features of the target NVMe disk and the types of native formatting commands that can be executed on the disk;

[0106] If the formatting support feature indicates that the disk supports administrator-level formatting operations, confirm that the native formatting command type is the NVMe admin format command;

[0107] If the formatting support features show that the disk only supports formatting operations of the Dataset Management class, then the native formatting command type is determined to be the NVMe IO Dataset Management command.

[0108] The NVMe admin format command is an administrator command in the NVMe protocol used to perform disk formatting operations.

[0109] The NVMe IO Dataset Management command is another type of command in the NVMe protocol that supports formatting-related operations. It mainly achieves a formatting-like initialization effect by managing disk data sets and can be applied to some NVMe disks that do not support the NVMe admin format command.

[0110] Furthermore, when the command type is NVMe admin format command, the command is generated by following these steps: extracting the LBA_size of the target disk from the disk information table, as well as the Format NVM Attributes (i.e., format NVM attributes) from other formatting parameters.

[0111] Among them, Format NVM Attributes is a core configuration parameter of the NVMe admin format command in the NVMe protocol, used to define the specific rules and behaviors of the formatting operation. Here, the NVMe protocol requires that the NVMe admin format command must carry the Format NVM Attributes parameter; otherwise, the disk will not recognize it or will refuse to execute the command.

[0112] Fill the LBA_size field into the LBA field of the Submission Queue Entry (SQE) of the NVMe protocol, fill the Format NVM Attributes field into the Format NVM Attributes field of the Submission Queue Entry, configure the command opcode field of the Submission Queue Entry to the opcode corresponding to the NVMe admin format command specified by the NVMe protocol, and use the SQE with completed parameter filling as the native formatting command of NVMe admin format.

[0113] SQE is a standardized data structure used in the NVMe protocol to encapsulate commands. After being filled according to the NVMe protocol specifications, it is placed in the disk's commit queue. The opcode corresponding to the NVMe admin format command is a value specified by the NVMe protocol to identify administrator-level formatting commands. After the opcode field is filled in, the disk can recognize the command as a formatting operation.

[0114] Furthermore, when the command type is NVMe IO Dataset Management command, generate the command by following these steps:

[0115] Retrieve the disk capacity information of the target disk from the LBA_size and other formatting parameters in the disk information table;

[0116] Fill LBA_size into the LBA field of SQE to ensure that the logic block size matches;

[0117] Fill in the disk capacity information into the capacity-related fields of SQE to specify the range of disk capacity covered by the formatting operation;

[0118] Configure the SQE command opcode field to the NVMe IO Dataset Management command opcode specified by the NVMe protocol, and use the SQE with completed parameter filling as the native formatting command of NVMe IO Dataset Management.

[0119] The adaptive disk formatting method and apparatus for RAID cards disclosed in the above embodiments strictly extract required parameters such as Format NVM Attributes and LBA_size according to the NVMe protocol specification and fill them into the corresponding fields of SQE. Simultaneously, standard opcodes are configured to ensure that the generated native formatting command fully complies with NVMe protocol requirements. This avoids disk unrecognition or command refusal due to missing parameters or incorrect fields, ensuring the protocol compliance and execution effectiveness of NVMe disk formatting commands. Based on the formatting support characteristics in the disk information table, the NVMe admin format or NVMe IO Dataset Management command is dynamically selected, eliminating the need for users to manually distinguish disk capabilities and improving the RAID card's compatibility with different types of NVMe disks. Extracting the fixed LBA_size from the disk information table and filling it into SQE forces the formatting operation to use the disk's inherent logical block size, preventing changes in LBA_size after formatting. This ensures that the disk can be normally connected to the RAID array after formatting, without affecting subsequent data read / write and RAID functions, guaranteeing the compatibility and stability of the storage system.

[0120] In one possible implementation of step S203 above, the conversion of the uniform formatting command into a native formatting command corresponding to the target disk's protocol, based on the protocol type and formatting support characteristics, further includes:

[0121] If the target disk's protocol type is SATA, generate the register frame structure information instruction corresponding to the SATA protocol, and use the register frame structure information instruction as the carrier of the native formatting command of the SATA protocol.

[0122] Configure the Command field of the register frame structure information instruction to the first value; the first value is the fixed opcode corresponding to the FORMAT UNIT formatting command in the SATA protocol;

[0123] Based on the formatting type in the uniform formatting command, configure the Features_low field of the register frame structure information instruction: if the formatting type is quick formatting, set the Features_low field to the second value; if the formatting type is normal formatting, set the Features_low field to the third value.

[0124] Configure the Device / head field of the Register Frame Structure Information instruction to the fourth value to enable logical block address mode and select the target disk as the master device;

[0125] Configure the Sector_count field of the register frame structure information instruction to 0 to specify that a full disk formatting operation should be performed on the target disk;

[0126] Configure all other fields related to the logical block address in the register frame structure information instruction to 0 to ensure that the formatting operation does not depend on the logical block address;

[0127] The configured register frame structure information instruction is sent to the target disk so that the target disk can parse the register frame structure information instruction and execute the corresponding FORMAT UNIT formatting operation.

[0128] In this embodiment, since the communication of the SATA protocol requires frame information structure (FIS), the formatting operation needs to use the register frame structure information instruction (Host-to-Device FIS, register FIS) as the carrier of the native formatting command of the SATA protocol.

[0129] Configure the Command field of the register frame structure information instruction to the first value, including: configure the Command field of the register frame structure information instruction to 0x4.

[0130] The Command field is a command type identifier field in the native formatting command carrier of the SATA / SAS protocol, used to store the fixed opcode of the corresponding formatting command. 0x4 is the fixed opcode corresponding to the FORMAT UNIT formatting command in the SATA protocol, which can serve as the core identifier for SATA disks to recognize formatting commands. When filled in, the disk can directly determine that the command type is a formatting operation. The FORMAT UNIT formatting command is the standard command in the SATA / SAS protocol used to perform disk formatting operations.

[0131] If the formatting type is quick format, set the Features_low field to the second value, including:

[0132] If the formatting type is quick format, set the Features_low field to 0x80.

[0133] The Features_low field is a formatting type configuration field in the native formatting command carrier of the SATA protocol, used to define the specific mode of the formatting operation. Furthermore, the SATA protocol specifies that for quick formatting, the Features_low field must be set to 0x80.

[0134] If the formatting type is normal formatting, set the Features_low field to a third value, including:

[0135] If the formatting type is normal formatting, set the Features_low field to 0x00.

[0136] The SATA protocol specifies that for normal formatting, the Features_low field must be set to 0x00.

[0137] Configure the Device / head field of the register frame structure information instruction to the fourth value to enable logical block address mode and select the target disk as the master device, including:

[0138] Configure the Device / head field of the Register Frame Structure Information instruction to 0xA0.

[0139] The 0xA0 configuration ensures that the disk is formatted in LBA mode, while clearly defining the target disk as the master device, thus preventing commands from being sent to other slave devices.

[0140] In addition, regarding the Sector_count field and other LBA-related fields, setting the Sector_count field to 0 indicates formatting the entire disk, and setting other LBA-related fields to 0 indicates that the formatting operation does not depend on a specific LBA address. This configuration can ensure that the formatting covers the entire storage area of ​​the target disk, and there is no need to obtain the specific LBA address range of the disk in advance, thereby simplifying the command configuration process.

[0141] The Sector_count field is a formatting range configuration field in the native formatting command carrier of the SATA protocol. It is used to specify the number of sectors covered by the formatting operation, and thus determine whether to perform a full disk format.

[0142] The adaptive disk formatting method and apparatus for RAID cards disclosed in the above embodiments explicitly define the SATA native formatting command carrier as the FIS register and configure the core parameters of each field according to the SATA protocol specification. This ensures that the command conforms to the SATA protocol requirements and avoids disk recognition failure or command refusal due to carrier errors or improper field configuration. By configuring the Sector_count field to 0, the forced formatting operation covers all storage sectors of the target SATA disk, avoiding the problem of some areas not being formatted due to incomplete sector range settings. At the same time, it eliminates the need to obtain the disk LBA address range in advance, simplifies the command configuration logic, and ensures that the storage area after disk formatting can be fully used.

[0143] In one possible implementation of step S203 above, the conversion of the uniform formatting command into a native formatting command corresponding to the target disk's protocol, based on the protocol type and formatting support characteristics, further includes:

[0144] If the target disk's protocol type is SAS, generate the SCSI FORMAT UNIT command corresponding to the SAS protocol, and use the SCSI FORMAT UNIT command as the carrier of the native formatting command of the SAS protocol.

[0145] Configure the Command field of the SCSI FORMAT UNIT command to the first value; the first value is also the fixed opcode corresponding to the FORMAT UNIT formatting command in the SAS protocol;

[0146] Based on the formatting support characteristics of the target disk in the disk information table, configure the Flags field of the SCSI FORMAT UNIT command, including: setting the 0th and 1st bits of the Flags field to 0 to use the default defect list format; setting the 3rd bit of the Flags field to 0 to indicate that the parameter list is not sent to the target disk; and setting the 2nd bit of the Flags field to 1 to indicate that the defect list completion function is enabled.

[0147] Configure the Resved field of the SCSI FORMAT UNIT command to 0, configure the Interleave field to the fifth value to use the default interleaved setting, and configure the Control field to the third value;

[0148] If the formatting support characteristics of the target disk indicate that the target disk requires special configuration of the defect list related parameters, adjust the defect list format of the 0th and 1st positions in the Flags field, as well as the defect list completion flag of the 2nd position, based on the formatting support characteristics to ensure that it matches the formatting capabilities of the target disk.

[0149] The configured SCSI FORMAT UNIT command is sent to the target disk so that the target disk can parse the SCSI FORMAT UNIT command and perform the corresponding full disk formatting operation.

[0150] In this embodiment, the SCSI FORMAT UNIT command is a standardized formatting instruction that can be directly parsed by the SAS disk, ensuring that the command is fully compatible with the communication protocol of the SAS disk and avoiding the inability to recognize the command due to carrier incompatibility.

[0151] Configure the Command field of the SCSI FORMAT UNIT command to 0x4.

[0152] Here, 0x4 is the core identifier for SAS disk formatting commands. After being entered, the disk can directly determine that the command type is a formatting operation.

[0153] Furthermore, the 0th and 1st bits of the Flags field are set to 0 to adopt the default defect list format of the SCSI protocol.

[0154] Setting the third bit of the Flags field to 0 indicates that no additional parameter list will be sent to the target disk, simplifying the command configuration process; setting the second bit of the Flags field to 1 indicates that the defect list completion function is enabled, ensuring that the disk completes the detection and recording of the defect list during the formatting process, which conforms to the file's defect list management specifications.

[0155] Furthermore, configure the Resved field of the SCSI FORMAT UNIT command to 0, the Interleave field to 0x0000 to use the default interleaved settings, and the Control field to 0x00.

[0156] The Interleave field, configured to 0x0000, indicates that the default interleaving setting is used, requiring no custom parameters and thus simplifying configuration. The Control field is used to control the basic logic of command execution; configuring the Control field to 0x00 ensures that commands are executed according to the flow.

[0157] If the target disk's formatting support characteristics indicate that the target disk requires special configuration of defect list related parameters, adjust the defect list format of the 0th and 1st positions in the Flags field based on the formatting support characteristics, changing them from the default 0 to the defect list format value specified by the formatting support characteristics, and change the defect list completion flag of the 2nd position from the default 1 to 0, to ensure that it matches the formatting capabilities of the target disk.

[0158] The configured SCSI FORMAT UNIT command is sent to the target SAS disk through the communication link specified by the SAS protocol, so that the target SAS disk can parse the SCSI FORMAT UNIT command and perform the corresponding full disk formatting operation.

[0159] The adaptive disk formatting method and apparatus for RAID cards disclosed in the above embodiments use the SCSIFORMAT UNIT command as a carrier and configure fields such as Command and Flags according to the file specification to ensure that the command fully complies with the SAS protocol requirements. This avoids the SAS disk being unable to parse or refuse to execute commands due to carrier errors or abnormal field values, and ensures that the formatting operation is stably implemented.

[0160] In one embodiment, please refer to Figure 4 , Figure 4 This is a schematic flowchart illustrating an adaptive disk formatting method for a RAID card provided in this disclosure embodiment. The process may include the following steps:

[0161] Step S401: Parse the issued uniform formatting command.

[0162] Here, the system receives and parses the standardized formatting commands sent by the user through the host.

[0163] Step S402: Query the disk information table.

[0164] Here, the pre-stored disk information table is queried based on the unique identifier in the uniform formatting command to obtain the protocol type and formatting support features of the target disk.

[0165] Step S403, is the protocol type NVMe? If yes, proceed to step S404; otherwise, proceed to step S405.

[0166] Here, we determine whether the target disk's protocol type is NVMe.

[0167] Step S404, convert to NVMe command.

[0168] Here, the uniform formatting command is converted into an NVMe command that the target NVMe disk can execute.

[0169] Step S405, is the protocol type SATA? If yes, proceed to step S406; otherwise, proceed to step S407.

[0170] Here, we determine whether the target disk's protocol type is SATA.

[0171] Step S406: Convert to SATA commands.

[0172] Here, the uniform formatting command is converted into SATA commands that the target SATA disk can execute.

[0173] Step S407, is the protocol type SAS? If so, proceed to step S408.

[0174] Here, we determine whether the target disk's protocol type is SAS.

[0175] Step S408, convert to SAS command.

[0176] Here, the uniform formatting command is converted into a SAS command that the target SAS disk can execute.

[0177] In one embodiment, an adaptive disk formatting apparatus 500 for a RAID card is provided, which corresponds one-to-one with the adaptive disk formatting method for a RAID card described in the above embodiments. For example... Figure 5 As shown, the adaptive disk formatting device 500 for RAID cards includes a command acquisition module 501, an information query module 502, a command conversion module 503, a command issuance module 504, and a result feedback module 505. The detailed descriptions of each functional module are as follows:

[0178] The command acquisition module 501 is used to receive and parse the uniform formatting command issued by the host, and obtain the unique identifier, command identifier and formatting type contained in the uniform formatting command; wherein, the unique identifier is used to index the target disk, and the command identifier is used to identify that the uniform formatting command is a disk formatting command; the formatting type includes one of the following: quick format, normal format or query formatting progress;

[0179] The information query module 502 is used to query the pre-stored disk information table based on the unique identifier to obtain the protocol type and formatting support characteristics of the target disk; wherein, the disk information table includes at least the logical block address size, protocol type and supported formatting command capabilities of each disk;

[0180] Command conversion module 503 is used to convert uniform formatting commands into native formatting commands corresponding to the target disk's protocol, based on the protocol type and formatting support characteristics.

[0181] The command delivery module 504 is used to deliver the converted native formatting command to the target disk for execution, and to ensure that the logical block address size of the target disk remains unchanged before and after formatting.

[0182] The result feedback module 505 is used to asynchronously obtain the formatting execution result of the target disk and feed it back to the host.

[0183] In one embodiment, the adaptive disk formatting apparatus 500 for a RAID card further includes an information table construction module 506, wherein:

[0184] The information table construction module 506 is used to send information retrieval instructions to each disk and receive response information returned by each disk based on the information retrieval instructions when initialization or when a new disk is inserted.

[0185] Parse the response information to obtain the protocol type, formatting support features, logical block address size, and other formatting parameters for each disk; among which, the protocol type includes, but is not limited to: NVMe protocol, SATA protocol, or SAS protocol;

[0186] The disk information table is constructed by associating and storing the protocol type, formatting support features, logical block address size, and other formatting parameters of each disk with the unique identifier of the corresponding disk.

[0187] In one embodiment, the adaptive disk formatting apparatus 500 for a RAID card further includes a type matching module 507, wherein:

[0188] The type matching module 507 is used to determine whether the formatting type in the uniform formatting command matches the formatting support features of the target disk;

[0189] If a match is found, the unified formatting command will be converted into the native formatting command of the target disk's corresponding protocol, based on the protocol type and formatting support features.

[0190] If a mismatch occurs, a formatting error message will be generated and sent back to the host.

[0191] In one embodiment, the command conversion module 503 is specifically used to query the formatting support characteristics of the target disk in the disk information table if the protocol type of the target disk is NVMe protocol, and determine the type of the native formatting command of the target disk based on the formatting support characteristics;

[0192] If the native formatting command for the target disk is the NVMe admin format command, extract the logical block address size of the target disk from the disk information table, as well as the Format NVM Attributes from other formatting parameters;

[0193] Fill the logical block address size into the LBA field of the NVMe protocol's commit queue entry, fill the Format NVMAttributes field of the commit queue entry, and configure the command opcode field of the commit queue entry to the opcode corresponding to the NVMe admin format command specified by the NVMe protocol, thereby generating the NVMeadmin format native formatting command.

[0194] If the native formatting command for the target disk is the NVMe IO Dataset Management command, extract the logical block address size of the target disk and the disk capacity information from other formatting parameters from the disk information table;

[0195] Fill the logical block address size into the LBA field of the submission queue entry, fill the disk capacity information into the capacity-related field of the submission queue entry, and configure the command opcode field of the submission queue entry to the opcode corresponding to the NVMeIO Dataset Management command specified by the NVMe protocol to generate the NVMe IO Dataset Management native formatting command;

[0196] The generated NVMe admin format or NVMe IO Dataset Management native format command corresponding to the commit queue entry is placed into the commit queue of the target disk, and a notification signal is written to the doorbell register of the target disk so that the target disk reads the commit queue entry based on the notification signal.

[0197] In one embodiment, the command conversion module 503 is further configured to generate a register frame structure information instruction corresponding to the SATA protocol if the protocol type of the target disk is SATA protocol, and use the register frame structure information instruction as the carrier of the native formatting command of the SATA protocol.

[0198] Configure the Command field of the register frame structure information instruction to the first value; the first value is the fixed opcode corresponding to the FORMAT UNIT formatting command in the SATA protocol;

[0199] Based on the formatting type in the uniform formatting command, configure the Features_low field of the register frame structure information instruction: if the formatting type is quick formatting, set the Features_low field to the second value; if the formatting type is normal formatting, set the Features_low field to the third value.

[0200] Configure the Device / head field of the Register Frame Structure Information instruction to the fourth value to enable logical block address mode and select the target disk as the master device;

[0201] Configure the Sector_count field of the register frame structure information instruction to 0 to specify that a full disk formatting operation should be performed on the target disk;

[0202] Configure all other fields related to the logical block address in the register frame structure information instruction to 0 to ensure that the formatting operation does not depend on the logical block address;

[0203] The configured register frame structure information instruction is sent to the target disk so that the target disk can parse the register frame structure information instruction and execute the corresponding FORMAT UNIT formatting operation.

[0204] In one embodiment, the command conversion module 503 is further configured to generate a SCSI FORMAT UNIT command corresponding to the SAS protocol if the target disk's protocol type is SAS, and use the SCSI FORMAT UNIT command as a carrier of the SAS protocol's native formatting command.

[0205] Configure the Command field of the SCSI FORMAT UNIT command to the first value; the first value is also the fixed opcode corresponding to the FORMAT UNIT formatting command in the SAS protocol;

[0206] Based on the formatting support characteristics of the target disk in the disk information table, configure the Flags field of the SCSI FORMAT UNIT command, including: setting the 0th and 1st bits of the Flags field to 0 to use the default defect list format; setting the 3rd bit of the Flags field to 0 to indicate that the parameter list is not sent to the target disk; and setting the 2nd bit of the Flags field to 1 to indicate that the defect list completion function is enabled.

[0207] Configure the Resved field of the SCSI FORMAT UNIT command to 0, configure the Interleave field to the fifth value to use the default interleaved setting, and configure the Control field to the third value;

[0208] If the formatting support characteristics of the target disk indicate that the target disk requires special configuration of the defect list related parameters, adjust the defect list format of the 0th and 1st positions in the Flags field, as well as the defect list completion flag of the 2nd position, based on the formatting support characteristics to ensure that it matches the formatting capabilities of the target disk.

[0209] The configured SCSI FORMAT UNIT command is sent to the target disk so that the target disk can parse the SCSI FORMAT UNIT command and perform the corresponding full disk formatting operation.

[0210] It should be noted that the adaptive disk formatting device for RAID cards provided in the above embodiments is only illustrated by the division of the above program modules when implementing the corresponding adaptive disk formatting method for RAID cards. In practical applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the above system can be divided into different program modules to complete all or part of the processing described above. In addition, the system provided in the above embodiments and the corresponding Figure 2 The embodiments of the methods shown belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0211] This disclosure also provides an electronic device having the above-described features. Figure 5 The image shows an adaptive disk formatting device for a RAID card.

[0212] Please see Figure 6 , Figure 6 This is a schematic diagram of another adaptive disk formatting device for a RAID card provided in this disclosure embodiment, as shown below. Figure 6As shown, the electronic device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise as required. The processors can process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple electronic devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 6 Take a processor 10 as an example.

[0213] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0214] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.

[0215] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0216] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0217] The electronic device also includes an input device 30 and an output device 40. The processor 10, memory 20, input device 30, and output device 40 can be connected via a bus or other means. Figure 6 Taking the example of a connection between China and Israel via a bus.

[0218] Input device 30 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the electronic device, such as a touch screen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 40 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, light-emitting diodes, displays, and plasma displays. In some alternative embodiments, the display device may be a touch screen.

[0219] The electronic device also includes a communication interface for communicating with other devices or communication networks.

[0220] This disclosure also provides a computer-readable storage medium in which the methods described in this disclosure can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded over a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium may be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code that, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0221] A portion of this disclosure can be applied to computer program products, such as computer program instructions, which, when executed by a computer, can invoke or provide methods and / or technical solutions according to this disclosure through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, and installation package files. Accordingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions; the computer compiling the instructions and then executing the corresponding compiled program; the computer reading and executing the instructions; or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0222] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. An adaptive disk formatting method for a RAID card, characterized in that, The method includes: Receive and parse the uniform formatting command issued by the host, and obtain the unique identifier, command identifier and formatting type contained in the uniform formatting command; wherein, the unique identifier is used to index the target disk, the command identifier is used to identify that the uniform formatting command is a disk formatting command; the formatting type includes one of the following: quick format, normal format or query formatting progress; The target disk's protocol type and formatting support features are obtained by querying the pre-stored disk information table based on the unique identifier; wherein the disk information table includes at least the logical block address size, protocol type, and supported formatting command capabilities of each disk. Based on the protocol type and the formatting support features, the unified formatting command is converted into the native formatting command of the target disk's corresponding protocol; The converted native formatting command is sent to the target disk for execution, and the size of the logical block address of the target disk remains unchanged before and after formatting. The formatting execution result of the target disk is obtained asynchronously and fed back to the host.

2. The method according to claim 1, characterized in that, The pre-stored disk information table is constructed based on the following steps: When initializing or inserting a new disk, send information retrieval commands to each disk and receive response information returned by each disk based on the information retrieval commands; The response information is parsed to obtain the protocol type, formatting support features, logical block address size, and other formatting parameters of each disk; wherein, the protocol type includes, but is not limited to: NVMe protocol, SATA protocol, or SAS protocol; The disk information table is constructed by associating and storing the protocol type, formatting support features, logical block address size, and other formatting parameters of each disk with the unique identifier of the corresponding disk.

3. The method according to claim 2, characterized in that, Before converting the uniform formatting command into a native formatting command corresponding to the target disk's protocol based on the protocol type and the formatting support characteristics, the method further includes: Determine whether the formatting type in the uniform formatting command matches the formatting support features of the target disk; If a match is found, the unified formatting command is converted into the native formatting command of the target disk's corresponding protocol, based on the protocol type and the formatting support features. If a mismatch occurs, a formatting error message is generated and sent back to the host.

4. The method according to claim 3, characterized in that, The step of converting the unified formatting command into a native formatting command corresponding to the target disk's protocol based on the protocol type and the formatting support characteristics includes: If the target disk's protocol type is NVMe, query the disk information table for the target disk's formatting support characteristics, and determine the type of the target disk's native formatting command based on the formatting support characteristics; If the native formatting command for the target disk is the NVMe admin format command, extract the logical block address size of the target disk, as well as the Format NVM Attributes from other formatting parameters, from the disk information table; The logical block address size is filled into the LBA field of the NVMe protocol's submission queue entry, the Format NVMAttributes is filled into the Format NVM Attributes field of the submission queue entry, and the command opcode field of the submission queue entry is configured to the opcode corresponding to the NVMe admin format command specified by the NVMe protocol, thereby generating the NVMe admin format native formatting command. If the native formatting command for the target disk is the NVMe IO Dataset Management command, extract the logical block address size of the target disk and the disk capacity information from other formatting parameters from the disk information table; The logical block address size is filled into the LBA field of the submission queue entry, the disk capacity information is filled into the capacity-related field of the submission queue entry, and the command opcode field of the submission queue entry is configured to the opcode corresponding to the NVMe IO Dataset Management command specified by the NVMe protocol to generate the NVMe IO DatasetManagement native formatting command. The generated NVMe admin format native formatting command or NVMe IO Dataset Management native formatting command is placed into the commit queue of the target disk, and a notification signal is written to the doorbell register of the target disk so that the target disk reads the commit queue entry based on the notification signal.

5. The method according to claim 4, characterized in that, The step of converting the unified formatting command into a native formatting command corresponding to the target disk protocol based on the protocol type and the formatting support characteristics further includes: If the target disk's protocol type is SATA, generate the register frame structure information instruction corresponding to the SATA protocol, and use the register frame structure information instruction as the carrier of the native formatting command of the SATA protocol; Configure the Command field of the register frame structure information instruction to a first value; the first value is the fixed opcode corresponding to the FORMAT UNIT formatting command in the SATA protocol; Based on the formatting type in the uniform formatting command, configure the Features_low field of the register frame structure information instruction: if the formatting type is quick formatting, set the Features_low field to the second value; if the formatting type is normal formatting, set the Features_low field to the third value. Configure the Device / head field of the register frame structure information instruction to the fourth value to enable logical block address mode and select the target disk as the master device; Configure the Sector_count field of the register frame structure information instruction to 0 to specify that a full disk formatting operation should be performed on the target disk; Configure all other fields related to the logical block address in the register frame structure information instruction to 0 to ensure that the formatting operation does not depend on the logical block address. The configured register frame structure information instruction is sent to the target disk so that the target disk can parse the register frame structure information instruction and execute the corresponding FORMAT UNIT formatting operation.

6. The method according to claim 5, characterized in that, The step of converting the unified formatting command into a native formatting command corresponding to the target disk protocol based on the protocol type and the formatting support characteristics further includes: If the target disk's protocol type is SAS, generate the SCSI FORMAT UNIT command corresponding to the SAS protocol, and use the SCSI FORMAT UNIT command as the carrier of the native formatting command of the SAS protocol. Configure the Command field of the SCSI FORMAT UNIT command to the first value; the first value is also the fixed opcode corresponding to the FORMAT UNIT formatting command in the SAS protocol; Based on the formatting support characteristics of the target disk in the disk information table, configure the Flags field of the SCSI FORMAT UNIT command, including: setting the 0th and 1st bits of the Flags field to 0 to use the default defect list format; setting the 3rd bit of the Flags field to 0 to indicate that the parameter list is not sent to the target disk; and setting the 2nd bit of the Flags field to 1 to indicate that the defect list completion function is enabled. Configure the Resved field of the SCSI FORMAT UNIT command to 0, configure the Interleave field to the fifth value to use the default interleaved setting, and configure the Control field to the third value; If the formatting support feature of the target disk indicates that the target disk requires special configuration of the defect list related parameters, adjust the defect list format of the 0th and 1st positions in the Flags field, as well as the defect list completion flag of the 2nd position, based on the formatting support feature to ensure that it matches the formatting capability of the target disk; The configured SCSI FORMAT UNIT command is sent to the target disk so that the target disk can parse the SCSI FORMAT UNIT command and perform the corresponding full disk formatting operation.

7. An adaptive disk formatting device for a RAID card, characterized in that, The device includes: The command acquisition module is used to receive and parse the uniform formatting command issued by the host, and obtain the unique identifier, command identifier and formatting type contained in the uniform formatting command; wherein, the unique identifier is used to index the target disk, the command identifier is used to identify that the uniform formatting command is a disk formatting command; the formatting type includes one of the following: quick format, normal format or query formatting progress; The information query module is used to query a pre-stored disk information table based on the unique identifier to obtain the protocol type and formatting support characteristics of the target disk; wherein, the disk information table includes at least the logical block address size, protocol type and supported formatting command capabilities of each disk; The command conversion module is used to convert the unified formatting command into the native formatting command of the target disk's corresponding protocol based on the protocol type and the formatting support characteristics. The command delivery module is used to deliver the converted native formatting command to the target disk for execution, and to ensure that the logical block address size of the target disk remains unchanged before and after formatting. The result feedback module is used to asynchronously obtain the formatting execution result of the target disk and feed it back to the host.

8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the adaptive disk formatting method for a RAID card as described in any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the adaptive disk formatting method for a RAID card as described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the adaptive disk formatting method for a RAID card as described in any one of claims 1 to 6.