Storage disk information acquisition method, controller, equipment and storage medium
By splitting the total task into sub-tasks and locking it during execution, the problem of low efficiency in accessing equipment/disks and information acquisition of storage systems is solved, efficient parallel processing is achieved, and the efficiency of acquisition of storage disk information is improved.
Patent Information
- Application Number
- CN202411320118.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-14
AI Technical Summary
The prior art is inefficient in discovering storage devices/disks accessed by the storage system and acquiring storage disk information, resulting in inefficiency.
Split the total task of obtaining the storage disk accessed by the storage system into multiple subtasks, and add resource locks before executing each subtask to ensure data consistency and allow multiple subtasks to be executed in parallel to improve efficiency.
It improves the efficiency of discovering storage devices/disks connected to the storage system and obtaining storage disk information, and prevents inconsistency problems caused by multiple threads simultaneously modifying data.
Smart Images

Figure CN119311403A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, controller, device and storage medium for acquiring storage disk information. Background Art
[0002] With the development of storage systems, the application scenarios are becoming more and more complex. For example, in a storage system, the front-end device interacts with the host to receive and process the instructions or requests issued by the host; the back-end of the storage system is connected to the storage device through a network link, such as a Peripheral Component Interconnect Express (PCIE) link or a fabric link. When the back-end needs to connect multiple storage disks, such as disks in JBOD or EBOF, to the storage system, it is necessary to apply for storage system resources for concurrent processing to discover the storage devices / disks connected to the storage system.
[0003] Normally, based on a standard spin lock, each storage device / disk is traversed to find the storage device / disk connected to the storage system, and then the storage disk information is obtained. However, this method requires executing a complete general task of discovering a storage device / disk, and then executing the next complete general task of discovering the next storage device / disk, and then discovering all the storage devices / disks connected to the storage system, and then obtaining the storage disk information, resulting in low efficiency in discovering the storage devices / disks connected to the storage system and obtaining storage disk information. Summary of the invention
[0004] In view of this, the present invention provides a method, controller, device and storage medium for acquiring storage disk information to solve the problem of low efficiency in discovering storage devices / disks connected to a storage system and low efficiency in acquiring storage disk information.
[0005] In a first aspect, the present invention provides a method for obtaining storage disk information, which is applied to a storage controller of a storage system; the method comprises: receiving a discovery request sent by a cluster, and determining a target subtask based on the discovery request, wherein the target subtask is one of multiple subtasks included in a total task, and the total task is used to obtain configuration information of a storage disk connected to the storage system; according to the target subtask, searching for a thread corresponding to the target subtask in at least one correspondence relationship as the target thread, and starting the target thread, wherein each correspondence relationship is a one-to-one correspondence between a subtask and a thread; obtaining a resource lock, and adding the resource lock to the target thread, and executing the target subtask through the target thread to which the resource lock has been added; releasing the resource lock when detecting that the execution of the target subtask is completed; if the target subtask is the last subtask among multiple subtasks, obtaining configuration information, and reporting the configuration information to the cluster.
[0006] Based on the method of the first aspect above, when receiving a discovery request sent by a cluster, the target subtask and the target thread are determined based on the discovery request, and a resource lock is added to the target thread. The target subtask is executed by the target thread to which the resource lock has been added. The resource lock ensures that only one thread can access shared resources at the same time. Obviously, the total task is divided into multiple subtasks, and a resource lock is added before executing each subtask. This can prevent multiple threads from modifying the same data at the same time and causing data inconsistency. In addition, when the target subtask is executed, the resource lock is released so that the target thread can also execute the target subtasks in other total tasks in parallel. Compared with the related art, in which one total task is executed before the next total task is executed, the present invention can execute subtasks in multiple total tasks in parallel, which can improve the efficiency of discovering the storage disks connected to the storage system and the efficiency of obtaining storage disk information.
[0007] In an optional implementation, if the target subtask is not the last subtask, the next subtask is executed continuously until all subtasks in the multiple subtasks are executed, the configuration information is obtained, and the configuration information is reported to the cluster.
[0008] Based on the above method, the target subtask is not the last subtask, which means that the total task has not been completed. Therefore, the next subtask needs to be further executed to obtain configuration information.
[0009] In an optional embodiment, the number of multiple subtasks is 5, and according to the target subtask, a thread corresponding to the target subtask is searched in at least one correspondence relationship as the target thread, including: if the target subtask is the first subtask among the 5 subtasks, then according to the first correspondence relationship, it is determined that the target thread corresponding to the first subtask is the first thread, and the first correspondence relationship is the correspondence between the first subtask and the first thread.
[0010] Obtain a resource lock and add the resource lock to a target thread, and execute a target subtask through the target thread to which the resource lock has been added, including: obtaining a resource lock, starting a state machine, and using the first thread to which the resource lock has been added, the state machine is used to detect whether the overall task has been completed; traversing the storage disks associated with the domain where the storage controller is located, and obtaining all storage disks in the startup state in the storage system at the current moment.
[0011] Based on the above method, the first thread corresponding to the first subtask can be determined, and all storage disks in the storage system connected to the storage system at the current moment and in the started state can be found.
[0012] In an optional implementation, according to the target subtask, searching for a thread corresponding to the target subtask in at least one corresponding relationship as the target thread includes: if the target subtask is any one of the second subtask to the fourth subtask among the five subtasks, then according to at least one corresponding relationship, determining that the target thread corresponding to the second subtask to the fourth subtask is the second thread;
[0013] Obtain a resource lock, add the resource lock to a target thread, and execute a target subtask through the target thread to which the resource lock has been added, including: when the target subtask is the second subtask, obtain the resource lock, and obtain basic information of any storage disk among all storage disks through the second thread to which the resource lock has been added; or, when the target subtask is the third subtask, obtain the resource lock, and obtain the logical unit information status of any storage disk through the second thread to which the resource lock has been added; or, when the target subtask is the fourth subtask, obtain the resource lock, and determine whether basic information and logical unit information status have been obtained for each storage disk among all storage disks in the domain through the second thread to which the resource lock has been added; or, when the target subtask is the fifth subtask, obtain the resource lock, and re-execute the total task for all storage disks whose access status has changed through the second thread to which the resource lock has been added.
[0014] Based on the above method, the second thread can execute any one of the second to fifth subtasks, and then the second thread completes the overall task to discover the storage disk connected to the storage system.
[0015] In an optional implementation, basic information of any storage disk among all storage disks is obtained through the second thread to which the resource lock has been added, including: obtaining the port type of any storage disk through the second thread to which the resource lock has been added, and based on the port type, determining a discovery instruction sequence corresponding to the port type; executing the discovery instruction sequence through the second thread to which the resource lock has been added to obtain basic information of any storage disk.
[0016] Based on the above method, based on the port type of the storage disk, a discovery instruction sequence corresponding to the port type can be determined, and then basic information of the storage disk can be obtained.
[0017] In an optional implementation, the basic information includes the target device type of any storage disk, the logical unit information status includes chassis information and storage disk information, and the logical unit information status of any storage disk is obtained through the second thread to which the resource lock has been added, including: obtaining the preset device type of any storage disk; when the target device type is consistent with the preset device type, receiving the chassis information and storage disk information fed back by each storage disk through the second thread to which the resource lock has been added.
[0018] Based on the above method, the target device type and the preset device type included in the basic information of the storage disk can be compared to determine whether the storage disk currently connected is the storage disk expected to be connected, and then when the target device type is consistent with the preset device type, the logical unit information status of the storage disk is obtained.
[0019] In an optional implementation, when basic information and logical unit information status are obtained for each storage disk in all storage disks in the domain, the storage disks for which basic information and logical unit information status have been obtained are registered, and configuration information is generated based on the basic information and logical unit information status of the registered storage disks.
[0020] Based on the above method, the basic information and logical unit information status of all storage disks in the domain can be obtained, and the configuration information can be obtained based on the basic information and the logical unit information status, and the storage disks connected to the storage system can be discovered.
[0021] In a second aspect, the present invention provides a storage controller, which includes: a transceiver module for receiving a discovery request sent by a cluster, and determining a target subtask based on the discovery request, wherein the target subtask is one of multiple subtasks included in a total task, and the total task is used to obtain configuration information of a storage disk connected to a storage system; a processing module for searching, according to the target subtask, for a thread corresponding to the target subtask in at least one corresponding relationship as a target thread, and starting the target thread, wherein each corresponding relationship is a one-to-one correspondence between a subtask and a thread.
[0022] The processing module is used to obtain the resource lock and add the resource lock to the target thread, and execute the target subtask through the target thread to which the resource lock has been added; the processing module is used to release the resource lock when detecting that the target subtask is executed; the processing module is used to obtain the configuration information if the target subtask is the last subtask among multiple subtasks, and report the configuration information to the cluster.
[0023] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method for obtaining storage disk information of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0024] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method for acquiring storage disk information of the first aspect or any corresponding embodiment thereof.
[0025] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the method for obtaining storage disk information of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 is a topological diagram of a system for acquiring storage disk information according to an embodiment of the present invention;
[0028] Figure 2 is a flow chart of a method for acquiring storage disk information according to an embodiment of the present invention;
[0029] Figure 3 is a schematic diagram of the interaction between a domain thread and an ITN thread according to an embodiment of the present invention;
[0030] Figure 4 is a schematic diagram of another method for acquiring storage disk information according to an embodiment of the present invention;
[0031] Figure 5 is a structural block diagram of a storage controller according to an embodiment of the present invention;
[0032] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0034] The technical solution provided by the embodiment of the present invention is applied to the scenario of identifying and discovering the storage disk when the storage disk is connected to the storage system. In this scenario, the processing of this scenario is generally solved by locking resources and traversing to find the way to solve the concurrency problem. This method leads to low efficiency in discovering the storage device / disk connected to the storage system and low efficiency in obtaining storage disk information.
[0035] In order to solve the above technical problems, an embodiment of the present invention provides a method for obtaining storage disk information, which divides the overall task of obtaining the configuration information of the storage disk connected to the storage system into multiple subtasks, and adds resource locks when executing multiple subtasks, so as to discover the low efficiency of the storage device / disk connected to the storage system and the low efficiency of obtaining storage disk information.
[0036] Below Figure 1 Taking the storage disk information acquisition system 10 as an example, the method provided by the embodiment of the present invention is described. Figure 1 It is only a schematic diagram and does not constitute a limitation on the applicable scenarios of the technical solution provided in this application.
[0037] like Figure 1 As shown, Figure 1 4 is a topological diagram of a system for acquiring storage disk information according to an embodiment of the present invention. Figure 1 In the embodiment, the storage disk information acquisition system 10 may include: a storage system 101 and a disk cabinet 102 .
[0038] Optionally, the storage system 101 is also referred to as a storage control system, and can be used to access a certain number of storage media or storage devices, such as storage disks.
[0039] Furthermore, the storage system 101 includes: a cluster 1011 and a storage controller 1012. The disk cabinet 102 includes at least one storage disk, such as Figure 1 The system includes two storage disks, namely a first storage disk 1021 and a second storage disk 1022.
[0040] Optionally, cluster 1011 may also be referred to as a controller cluster, which is a distributed storage architecture including at least one controller. At least one controller of cluster 1011 is used to manage at least one controller (eg, storage controller 1012) to work together to improve the performance, reliability, and availability of the storage system.
[0041] The storage controller 1012 is a core component in the storage system 101 and is responsible for managing and controlling data read and write operations.
[0042] The enclosure 102 may be any type of enclosure. For example, the enclosure 102 may be a JBOD enclosure or an EBOF enclosure. Furthermore, the JBOD enclosure is a sas enclosure based on a sas link. The EBOF enclosure is a non-volatile memory interface (Non-Volatile Memory Express, nvme) enclosure based on a fabric link.
[0043] The first storage disk 1021 or the second storage disk 1022 may be any type of storage disk. The first storage disk 1021 or the second storage disk 1022 has a corresponding relationship with the disk cabinet 102 .
[0044] In this embodiment, the storage controller 1012, the first storage disk 1021, and the second storage disk 1022 belong to the same specific domain. The storage system 101 is an initiator based on the storage protocol communication. The first storage disk 1021 and the second storage disk 1022 are targets based on the storage protocol communication. The connection between the storage system 101 and the first storage disk 1021 or the second storage disk 1022 connected to the storage system 101 can be called an Initiator-to-Target connection, referred to as an ITN connection.
[0045] Figure 1 The storage disk information acquisition system 10 shown is only used as an example and is not used to limit the technical solution of the present application. Those skilled in the art should understand that in the specific implementation process, the storage disk information acquisition system 10 may also include other disk cabinets and storage controllers, and the number of storage disks and storage controllers may also be determined according to specific needs without limitation.
[0046] According to an embodiment of the present invention, an embodiment of a method for obtaining storage disk information is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0047] In this embodiment, a method for obtaining storage disk information is provided, which can be used in the above-mentioned storage controller 1012. Figure 2 is a flow chart of a method for acquiring storage disk information according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0048] S201: receiving a discovery request sent by a cluster, and determining a target subtask based on the discovery request.
[0049] The discovery request is used to request the storage controller to discover the storage disk connected to the storage system.
[0050] In an embodiment of the present invention, the target subtask is one of the multiple subtasks included in the general task. The general task is used to obtain configuration information of a storage disk connected to the storage system. In a possible implementation, assuming that the number of the multiple subtasks is 5, the 5 subtasks are respectively executed in the order of: the first subtask, the second subtask, the third subtask, the fourth subtask, and the fifth subtask.
[0051] In one example, when the storage controller receives a discovery request from the cluster for the first time, it determines that the target subtask is the first subtask based on the discovery request. When the storage controller receives another discovery request from the cluster for the second time, it determines that the target subtask can be the second subtask based on the other discovery request, and so on, until the storage controller receives the fifth discovery request from the cluster, and determines that the corresponding task is the fifth subtask.
[0052] Optionally, the storage controller may also receive a login event reported by the storage system platform layer, and trigger the determination of the target subtask based on the login event.
[0053] Optionally, the storage controller may also create or search for a login object, a device object, an itn login open object, and a media device object. The login object, the device object, the itn login open object, and the media device object may all be ITN objects.
[0054] S202: According to the target subtask, search for a thread corresponding to the target subtask in at least one corresponding relationship, use the thread as the target thread, and start the target thread.
[0055] Each correspondence is a one-to-one correspondence between a subtask and a thread, for example, a first correspondence exists between the first subtask and the first thread, and a second correspondence exists between the second subtask and the second thread.
[0056] This step specifically includes: if the target subtask is the first subtask, the storage controller determines, according to the first corresponding relationship, that the target thread corresponding to the first subtask is the first thread. Optionally, the first thread is a domain thread or an ITN thread.
[0057] When the storage controller receives a discovery request sent by the cluster, the first thread is the domain thread. When the storage controller receives a login event reported by the storage system platform layer, the first thread is the ITN thread.
[0058] In some optional implementations, if the target subtask is any one of the second to fourth subtasks among the five subtasks, the storage controller determines that the target thread corresponding to the second to fourth subtasks is the second thread based on at least one corresponding relationship.
[0059] Among them, the second thread is an ITN thread.
[0060] S203: Acquire a resource lock, add the resource lock to the target thread, and execute the target subtask through the target thread to which the resource lock has been added.
[0061] In some optional implementations, if the target subtask is the first subtask, the storage controller acquires the resource lock, starts the state machine, and traverses the storage disks associated with the domain where the storage controller is located through the first thread to which the resource lock has been added, to obtain all storage disks in the startup state in the storage system at the current moment.
[0062] The state machine is also called an ITN state machine. The state machine is used to detect whether the overall task is completed. It is understandable that if the ITN state machine is not completed, the storage controller can asynchronously initiate a discovery request.
[0063] In some optional implementations, when the target subtask is the second subtask, the storage controller acquires a resource lock, and acquires basic information of any storage disk among all storage disks through a second thread to which the resource lock has been added.
[0064] The basic information includes the model, serial number, firmware version, capacity, interface type, cache size, and current status of any storage disk. Optionally, the basic information includes the target device type of any storage disk. The target device type includes information such as device category, disk slot, and chassis.
[0065] In one example, the storage controller obtains the port type of any storage disk through the second thread to which the resource lock has been added, and based on the port type, determines the discovery instruction sequence corresponding to the port type; and executes the discovery instruction sequence through the second thread to which the resource lock has been added to obtain basic information of any storage disk.
[0066] The port type can be an nvme port type or a sas port type.
[0067] For the nvme port type, the storage controller determines the discovery instruction sequence corresponding to the port type as nvme_seq based on the nvme port type. For the sas port type, the storage controller determines the discovery instruction sequence corresponding to the port type as sas_seq based on the sas port type.
[0068] For example, the storage controller executes a discovery instruction sequence through the second thread to which the resource lock has been added, calls the request and callback function pair, and obtains basic information of any storage disk.
[0069] Furthermore, the storage controller can obtain the preset device type of any storage disk and compare it with the target device type (devtab type); if the target device type is consistent with the preset device type, the ITN connection and domain relationship are updated, and the state machine is driven to enter the next state.
[0070] In some optional implementations, when the target subtask is the third subtask, the storage controller acquires a resource lock, and acquires the logical unit information state of any storage disk through the second thread to which the resource lock has been added.
[0071] The logical unit information status (Logic unit, Lu) reflects various attributes and statuses related to the logical unit of the storage disk. The logical unit information status includes chassis information and storage disk information. Optionally, the Lu information status includes: online status (Online Status, capacity information (Capacity Information), access status (AccessStatus).
[0072] In one example, the storage controller obtains a preset device type of any storage disk; when the target device type is consistent with the preset device type, the chassis information and storage disk information fed back by each storage disk are received through the second thread to which the resource lock has been added.
[0073] Furthermore, the storage controller may assign the cached logical unit information state to the media device object and report the media device object to the cluster. The media device object corresponds to a unique identifier (UUID).
[0074] In some optional implementations, when the target subtask is the fourth subtask, the storage controller acquires the resource lock and determines, through the second thread to which the resource lock has been added, whether each storage disk in all storage disks in the domain has acquired the basic information and logical unit information status.
[0075] Optionally, when the storage controller obtains the basic information and the logical unit information status of each storage disk in all storage disks in the domain, the storage controller registers the storage disk for which the basic information and the logical unit information status have been obtained, and generates configuration information based on the basic information and the logical unit information status of the registered storage disk. The configuration information includes the basic information and the logical unit information status of the storage disk.
[0076] It can be understood that, when the basic information and the logical unit information status of each storage disk in all storage disks in the domain have not been obtained, the storage controller can continue to execute the total task multiple times until the basic information and the logical unit information status are obtained.
[0077] In some optional implementations, when the target subtask is the fifth subtask, the storage controller acquires the resource lock, and re-executes the overall task for all storage disks whose access status has changed in the storage disks through the second thread to which the resource lock has been added.
[0078] As you can understand, resource locks ensure that only one thread can access shared resources at the same time. This prevents multiple threads from modifying the same data at the same time, which can cause data inconsistency. When the storage controller is executing a general task, if it receives a new discovery request or login event again, it will execute the next general task concurrently.
[0079] S204: When the target subtask is detected to be completed, the resource lock is released.
[0080] Exemplarily, when detecting that the first subtask is completed, the storage controller initiates an asynchronous discovery request to request the second thread to execute the second subtask and release the resource lock at the same time.
[0081] It can be understood that after the storage controller releases the resource lock, it is equivalent to releasing the resources applied for executing the target subtask. At this time, the target thread can execute the target subtask of other overall tasks.
[0082] S205: If the target subtask is the last subtask among the multiple subtasks, the configuration information is obtained and reported to the cluster.
[0083] It can be understood that the last subtask indicates that all the subtasks corresponding to the total task at the current moment have been executed, and the configuration information of the storage disk connected to the storage system can be obtained.
[0084] Optionally, if the target subtask is not the last subtask, the storage controller continues to execute the next subtask until all subtasks in the multiple subtasks are completed, the configuration information is obtained, and the configuration information is reported to the cluster.
[0085] In the method provided by this embodiment, when receiving a discovery request sent by a cluster, the storage controller determines the target subtask and the target thread based on the discovery request, and adds a resource lock to the target thread, and executes the target subtask through the target thread to which the resource lock has been added. The resource lock ensures that only one thread can access the shared resource at the same time. Obviously, dividing the total task into multiple subtasks and adding a resource lock before executing each subtask can prevent multiple threads from modifying the same data at the same time, which may cause data inconsistency.
[0086] In addition, after the target subtask is executed, the resource lock is released, so that the target thread can also execute the target subtasks in other general tasks in parallel. Compared with the related art, in which one general task is executed before the next general task is executed, the present invention can execute subtasks in multiple general tasks in parallel, which can improve the efficiency of discovering the storage disk connected to the storage system and obtaining the storage disk information.
[0087] In this embodiment, a method for executing a total task with multiple threads is provided, such as Figure 3 As shown, Figure 3 is a schematic diagram of the interaction between the domain thread and the ITN thread according to an embodiment of the present invention. Figure 3 In the process, the storage controller receives the discovery request sent by the cluster, triggers the execution of the first subtask included in the total task in the thread context of the domain, and any subtask from the second subtask to the fifth subtask is executed in the ITN thread context.
[0088] It is understandable that the storage controller has concurrent application and asynchronous processing issues for domain resources when executing the overall task, so domain resource locks and other concurrent processing logic are added.
[0089] When the storage controller receives a discovery request or login event from the cluster, it triggers the ITN state machine, and the domain thread and ITN thread begin to interact, as follows:
[0090] 1. Domain thread adds resource lock.
[0091] 2. The domain thread queries whether the queued object of the itn object has been set; if it has been set, the resource lock is released directly and false is returned. If it has not been set, the pending_count member of the domaind object is incremented by 1, and the first subtask is executed, the queued member of the itn object is set, and after the first subtask is executed, the resource lock is released and true is returned.
[0092] The purpose of pending_count increasing by 1 is because there is an asynchronous discovery request to be executed in the current domain.
[0093] 3. If true is returned, the domain thread initiates an itn asynchronous discovery request, otherwise no processing is performed.
[0094] 4. After the domain thread initiates the itn asynchronous discovery request, it enters the ITN thread, the asynchronous task execution entry, adds the resource lock, the member pending_count of the domaind object is incremented by 1, and the resource lock is released.
[0095] At this time, pending_count is incremented by 1 because the current context is the entry point of the itn discovery task, that is, there is a new discovery request to join the domain.
[0096] 5. The ITN thread adds a resource lock, the pending_count member of the domain object is decremented by 1, and the queued flag of the current itn object is cleared to release the resource lock. At this time, the purpose of decrementing pending_count by 1 is because the itn task request has been switched to the task execution thread and is about to be executed (must be executed). Therefore, the pending_count of the domain needs to be decremented here.
[0097] 7. After the domain thread initiates the itn asynchronous discovery request again, it enters the ITN thread, adds the resource lock, executes any subtask from the second to the fifth subtask, and releases the resource lock after the execution is completed.
[0098] 8. After any subtask is completed, the domain resource lock can be added, the pending_count member of the domaind object is reduced by 1, and the resource lock is released. At this time, the purpose of the pending_count being reduced by 1 is that the current context is itn to find that the task has ended, so the number of pending requests of the domain must be reduced.
[0099] In this embodiment, another method for obtaining storage disk information is provided, such as Figure 4 As shown, Figure 4 is a schematic diagram of another method for acquiring storage disk information according to an embodiment of the present invention.
[0100] exist Figure 4 In the process, the storage controller receives the discovery request sent by the cluster, or the storage controller can also receive the login event reported by the storage system platform layer, start the itn state machine; obtain the port type of any storage disk, and execute the discovery instruction sequence corresponding to the port type, obtain the basic information of any storage disk, and update the ITN connection and domain relationship; obtain the logical unit information status of any storage disk, and update the lu and domain relationship; based on the basic information and logical unit information status of the storage disk, obtain the configuration information, report the configuration information to the cluster, and discover all storage disks connected to the storage system. Determine whether the access status of the storage disk has changed; if so, restart the itn state machine. If not, the process ends.
[0101] In this embodiment, a storage controller 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 devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0102] This embodiment provides a storage controller such as Figure 5 As shown, Figure 5 1 is a structural block diagram of a storage controller according to an embodiment of the present invention; the storage controller includes:
[0103] The transceiver module 501 is used to receive a discovery request sent by the cluster, and determine a target subtask based on the discovery request, where the target subtask is one of multiple subtasks included in the overall task, and the overall task is used to obtain configuration information of a storage disk connected to the storage system;
[0104] The processing module 502 is used to search for a thread corresponding to the target subtask in at least one correspondence relationship according to the target subtask, take it as the target thread, and start the target thread. Each correspondence relationship is a one-to-one correspondence between a subtask and a thread.
[0105] The processing module 502 is further used to obtain a resource lock, add the resource lock to the target thread, and execute the target subtask through the target thread to which the resource lock has been added.
[0106] The processing module 502 is further configured to release the resource lock when the target subtask is detected to be completed.
[0107] The processing module 502 is further configured to obtain configuration information if the target subtask is the last subtask among the multiple subtasks, and report the configuration information to the cluster.
[0108] In some optional implementations, the processing module 502 is further used to continue executing the next subtask if the target subtask is not the last subtask, until all subtasks in the multiple subtasks are completed, the configuration information is obtained, and the configuration information is reported to the cluster.
[0109] In some optional implementations, the number of multiple subtasks is 5, and the processing module 502 is specifically used to determine, if the target subtask is the first subtask among the 5 subtasks, that the target thread corresponding to the first subtask is the first thread according to the first corresponding relationship, and the first corresponding relationship is the corresponding relationship between the first subtask and the first thread; the processing module 502 is also specifically used to obtain a resource lock, and add the resource lock to the target thread, and execute the target subtask through the target thread to which the resource lock has been added, including: the processing module 502 is also specifically used to obtain a resource lock, start a state machine, and through the first thread to which the resource lock has been added, the state machine is used to detect whether the total task has been executed; the processing module 502 is also specifically used to traverse the storage disks associated in the domain where the storage controller is located, and obtain all storage disks in the startup state in the storage system at the current moment.
[0110] In some optional implementations, the processing module 502 is further specifically used to determine, based on at least one corresponding relationship, that the target thread corresponding to the second subtask to the fourth subtask is the second thread if the target subtask is any one of the second subtask to the fourth subtask among the five subtasks; the processing module 502 is further specifically used to obtain a resource lock when the target subtask is the second subtask, and obtain basic information of any one of all storage disks through the second thread to which the resource lock has been added.
[0111] Alternatively, processing module 502 is also specifically used to obtain a resource lock when the target subtask is the third subtask, and obtain the logical unit information status of any storage disk through the second thread to which the resource lock has been added; or, processing module 502 is also specifically used to obtain a resource lock when the target subtask is the fourth subtask, and determine whether each storage disk in all storage disks in the domain has obtained basic information and logical unit information status through the second thread to which the resource lock has been added. Alternatively, processing module 502 is also specifically used to obtain a resource lock when the target subtask is the fifth subtask, and re-execute the total task for all storage disks whose access status has changed through the second thread to which the resource lock has been added.
[0112] In some optional embodiments, the processing module 502 is also specifically used to obtain the port type of any storage disk through the second thread to which the resource lock has been added, and based on the port type, determine the discovery instruction sequence corresponding to the port type; the processing module 502 is also specifically used to execute the discovery instruction sequence through the second thread to which the resource lock has been added to obtain the basic information of any storage disk.
[0113] In some optional implementations, the basic information includes the target device type of any storage disk; the logical unit information status includes chassis information and storage disk information; the processing module 502 is also specifically used to obtain the preset device type of any storage disk; the processing module 502 is also specifically used to receive the chassis information and storage disk information fed back by each storage disk through the second thread to which the resource lock has been added when the target device type is consistent with the preset device type.
[0114] In some optional implementations, the processing module 502 is also specifically used to register the storage disk that has obtained the basic information and logical unit information status when each storage disk in all storage disks in the domain has obtained the basic information and logical unit information status, and generate configuration information based on the basic information and logical unit information status of the registered storage disk.
[0115] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0116] The storage controller in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0117] The embodiment of the present invention also provides a computer device having the above Figure 5 The storage controller is shown.
[0118] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0119] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0120] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0121] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device 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.
[0122] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0123] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0124] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0125] Part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes but is not limited to source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0126] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for obtaining storage disk information, characterized in that: A storage controller applied to a storage system; the method comprising: Receive a discovery request sent by the cluster, and determine a target subtask based on the discovery request, where the target subtask is one of multiple subtasks included in a general task, and the general task is used to obtain configuration information of a storage disk connected to the storage system; According to the target subtask, searching for a thread corresponding to the target subtask in at least one correspondence relationship as the target thread, and starting the target thread, wherein each correspondence relationship is a one-to-one correspondence between a subtask and a thread; Acquire a resource lock, add the resource lock to the target thread, and execute the target subtask through the target thread to which the resource lock has been added; When detecting that the target subtask is executed, releasing the resource lock; If the target subtask is the last subtask among the multiple subtasks, the configuration information is acquired and reported to the cluster.
2. The method according to claim 1, characterized in that: The method further comprises: If the target subtask is not the last subtask, continue to execute the next subtask until all subtasks in the multiple subtasks are completed, obtain the configuration information, and report the configuration information to the cluster.
3. The method according to claim 1, characterized in that: The number of the plurality of subtasks is 5, and searching, according to the target subtask, in at least one corresponding relationship for a thread corresponding to the target subtask as the target thread, includes: If the target subtask is the first subtask among the five subtasks, determining that the target thread corresponding to the first subtask is the first thread according to a first corresponding relationship, wherein the first corresponding relationship is a corresponding relationship between the first subtask and the first thread; The acquiring of the resource lock, adding the resource lock to the target thread, and executing the target subtask through the target thread to which the resource lock has been added, includes: Acquire the resource lock, start the state machine, and through the first thread to which the resource lock has been added, the state machine is used to detect whether the overall task has been completed; The storage disks associated with the domain where the storage controller is located are traversed to obtain all storage disks in the storage system in the startup state at the current moment.
4. The method according to claim 3, characterized in that The step of searching, according to the target subtask, a thread corresponding to the target subtask in at least one corresponding relationship as the target thread includes: If the target subtask is any one of the second to fourth subtasks among the five subtasks, then according to the at least one corresponding relationship, determining that the target thread corresponding to the second to fourth subtasks is the second thread; The acquiring of the resource lock, adding the resource lock to the target thread, and executing the target subtask through the target thread to which the resource lock has been added, includes: When the target subtask is the second subtask, the resource lock is acquired, and basic information of any storage disk among all storage disks is acquired through the second thread to which the resource lock has been added; or When the target subtask is the third subtask, acquiring the resource lock, and acquiring the logical unit information state of any one storage disk through the second thread to which the resource lock has been added; or When the target subtask is the fourth subtask, the resource lock is acquired, and the second thread to which the resource lock has been added determines whether each storage disk in all the storage disks in the domain has acquired the basic information and the logical unit information status; or When the target subtask is the fifth subtask, the resource lock is acquired, and the overall task is re-executed on the storage disks with changed access status among all the storage disks through the second thread to which the resource lock has been added.
5. The method according to claim 4, characterized in that The obtaining basic information of any one of the storage disks through the second thread to which the resource lock has been added includes: Acquire the port type of any one of the storage disks through the second thread to which the resource lock has been added, and determine, based on the port type, a discovery instruction sequence corresponding to the port type; The basic information of any one storage disk is acquired by executing the discovery instruction sequence through the second thread to which the resource lock has been added.
6. The method according to claim 5, characterized in that The basic information includes the target device type of any one of the storage disks, the logical unit information status includes chassis information and storage disk information, and the obtaining the logical unit information status of any one of the storage disks through the second thread to which the resource lock has been added includes: Obtaining a preset device type of any one of the storage disks; In a case where the target device type is consistent with the preset device type, the chassis information and the storage disk information fed back by each storage disk are received through the second thread to which the resource lock has been added.
7. The method according to claim 6, characterized in that The method further comprises: In a case where each storage disk among all the storage disks in the domain has obtained the basic information and the logical unit information status, the storage disk that has obtained the basic information and the logical unit information status is registered, and the configuration information is generated based on the basic information and the logical unit information status of the registered storage disk.
8. A storage controller, characterized in that: The storage controller comprises: A transceiver module, used to receive a discovery request sent by a cluster, and determine a target subtask based on the discovery request, wherein the target subtask is one of multiple subtasks included in a general task, and the general task is used to obtain configuration information of a storage disk connected to a storage system; A processing module, configured to search for a thread corresponding to the target subtask in at least one corresponding relationship according to the target subtask, use the thread as the target thread, and start the target thread, wherein each corresponding relationship is a one-to-one corresponding relationship between a subtask and a thread; The processing module is further used to obtain a resource lock, add the resource lock to the target thread, and execute the target subtask through the target thread to which the resource lock has been added; The processing module is further configured to release the resource lock when detecting that the target subtask is completed; The processing module is further configured to obtain the configuration information if the target subtask is the last subtask among the multiple subtasks, and report the configuration information to the cluster.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for obtaining storage disk information according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for obtaining storage disk information according to any one of claims 1 to 7.