Delay generation method and device of block device, storage system and storage medium
By delaying the generation of block devices after the storage system is started, and using multiple communication links and timers to determine the logical unit to resume configuration, the problem of generation failure during the storage system is solved, ensuring business continuity and efficiency.
Patent Information
- Application Number
- CN202510405602.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-11
AI Technical Summary
In the prior art, the generation of block devices fails when the storage system starts, which affects business continuity, mainly because the logic unit completes the instruction process in the unavailable stage, resulting in the generation failure.
By delaying the generation of block devices after the storage system is started, threads are established with the host side using multiple communication links, instructions are cached and configuration is determined by timers and status codes, and then the instruction flow is executed to ensure that the block devices are generated when the logic unit is available.
It effectively avoids block device generation failure, ensures business continuity, and improves the efficiency and reliability of storage system startup.
Smart Images

Figure CN120295669A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer storage technology, and particularly to a method and apparatus for delaying the generation of a block device, a storage system, and a storage medium. Background Art
[0002] A block device is an abstract mapping of a logical unit in a storage system at the host end, which converts storage resources into a standard device interface recognizable by the operating system at the host end, facilitating the invocation of upper-layer services.
[0003] Currently, in related technologies, after a storage system is started, the host end relies on a small computer system interface instruction flow in a fixed order to generate a block device. However, when the storage system is started, a large number of configurations need to be restored, which takes a long time. There may be a situation where the host end completes the instruction flow during a stage when the logical unit is unavailable, easily resulting in the failure of block device generation and affecting service continuity. Summary of the Invention
[0004] This application provides a method and apparatus for delaying the generation of a block device, a storage system, and a storage medium, so as to at least solve the problem that the generation of a block device fails in related technologies and affects service continuity.
[0005] This application provides a method for delaying the generation of a block device, including:
[0006] Establishing multiple communication links with the host end; one communication link corresponds to one thread;
[0007] Receiving multiple instructions sent by the host end, where the multiple instructions include a logical unit list query instruction;
[0008] Caching the multiple instructions into the start queue of each thread;
[0009] Starting a timer for each thread, and periodically executing the logical unit list query instruction to obtain a status code;
[0010] According to the status code, determining whether each logical unit in the logical unit list has restored the configuration. If it is determined that the configuration has not been restored, the status code is sent to the host end so that the host end resends the logical unit list query instruction according to the status code; until it is determined that each logical unit has restored the configuration according to the latest status code, the timer of each thread is exited;
[0011] Starting a public service timer, and periodically determining whether the timer of each thread has exited;
[0012] If it is determined that the timer has exited, then sequentially execute the multiple instructions in the start queue to obtain an execution result;
[0013] Sending the execution result to the host end so that the host end generates a block device.
[0014] The present application also provides a delay generation device for a block device, including:
[0015] A establishing module, configured to establish multiple communication links with the host side; one communication link corresponds to one thread;
[0016] A receiving module, configured to receive multiple instructions sent by the host side, where the multiple instructions include a logical unit list query instruction;
[0017] A caching module, configured to cache the multiple instructions into the startup queues of the respective threads;
[0018] A starting module, configured to start the timers of the respective threads, and periodically execute the logical unit list query instruction to obtain a status code;
[0019] An exiting module, configured to determine, according to the status code, whether each logical unit in the logical unit list has been restored to its configuration. If it is determined that the configuration has not been restored, the status code is sent to the host side so that the host side resends the logical unit list query instruction according to the status code; until it is determined according to the latest status code that each logical unit has been restored to its configuration, the timers of the respective threads are exited;
[0020] A judging module, configured to start a public service timer and periodically judge whether the timers of the respective threads have exited;
[0021] An executing module, configured to, if it is determined that the timers have exited, sequentially execute the multiple instructions in the startup queue to obtain an execution result;
[0022] A generating module, configured to send the execution result to the host side so that the host side generates a block device.
[0023] The present application also provides a storage system, including: a memory, configured to store a computer program; a processor, configured to implement the steps of any of the above block device delay generation methods when executing the computer program.
[0024] The present application also provides a computer-readable storage medium, in which a computer program is stored, where the computer program, when executed by a processor, implements the steps of any of the above block device delay generation methods.
[0025] The present application also provides a computer program product, including a computer program, where the computer program, when executed by a processor, implements the steps of any of the above block device delay generation methods.
[0026] Through this application, after the storage system is started, the host will send multiple instructions. After the storage system sequentially executes the multiple instructions, the host will generate a block device. During this process, the time for executing the multiple instructions is delayed through the status code to ensure that each logical unit executes the multiple instructions when it has recovered its configuration and is in the available stage. Specifically, when multiple instructions sent by the host are received, the multiple instructions are cached in the startup queue. The instruction for querying the logical unit list is periodically executed by the timer of each thread to obtain the status code. Whether each logical unit has recovered its configuration is judged according to the status code. If it is determined that the configuration has not been recovered, the time for executing the multiple instructions is delayed, and the status code is sent to the host to trigger the host to resend the instruction for querying the logical unit list until it is determined according to the latest status code that each logical unit has recovered its configuration, and then the timer of each thread exits. The public service timer periodically judges whether the timer of each thread has exited; if it is determined that it has exited, it means that each logical unit has recovered its configuration, ensuring that each logical unit sequentially executes the multiple instructions in the startup queue in the available stage, so that the host successfully generates a block device without affecting the continuity of the service. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] To more clearly illustrate the embodiments of this application, the following will briefly introduce the drawings required for the embodiments. Obviously, the drawings in the following description are only some embodiments of this application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0028] Figure 1 Schematic diagram of the relationship between the logical unit and the host provided by the embodiment of this application;
[0029] Figure 2 Schematic diagram of the relationship between the storage system and the host provided by the embodiment of this application;
[0030] Figure 3 Schematic flowchart of the method for delayed generation of the block device provided by the embodiment of this application;
[0031] Figure 4 Schematic illustration of the thread operation of the storage system provided by the embodiment of this application Figure 1 ;
[0032] Figure 5 Schematic timing diagram of the storage system executing multiple instructions provided by the embodiment of this application;
[0033] Figure 6 Schematic illustration of the thread operation of the storage system provided by the embodiment of this application Figure 2 ;
[0034] Figure 7 Schematic structural diagram of the device for delayed generation of the block device provided by the embodiment of this application;
[0035] Figure 8 It is a schematic structural diagram of the storage system provided by the embodiment of the present application. Specific embodiments
[0036] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0037] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0038] Currently, after the storage system is started in the related art, the host side depends on the small computer system interface instruction flow in a fixed order to generate a block device. However, a large number of configurations need to be restored when the storage system is started, which takes a long time. There may be a situation where the host side completes the instruction flow during the stage when the logical unit is unavailable, which easily leads to the failure of generating the block device and affects the business continuity.
[0039] To solve the problem in the related art that during the stage when the logical unit is unavailable, the host side completes the instruction process, resulting in the failure of block device generation and affecting business continuity. The embodiments of the present application propose the following technical concept: The inventor considered that during the stage when the logical unit is unavailable, the host side completes the instruction process, resulting in the failure of block device generation and affecting business continuity. The inventor thought of delaying the generation of the block device. After the storage system is started and the logical unit is restored to its configuration, when the logical unit is in the available stage, the instruction process is then executed to ensure the successful generation of the block device and avoid affecting business continuity. Multiple instructions sent by the host side are received, and among the multiple instructions, there is a logical unit list query instruction. The multiple instructions are first cached in the startup queue. Considering that after the storage system executes the logical unit list query instruction, a status code will be obtained, and it is possible to determine whether the logical unit is restored to its configuration based on this status code. Therefore, first obtain the logical unit list query instruction from the startup queue, execute the logical unit list query instruction to obtain the status code. Determine whether each logical unit is restored to its configuration based on the status code. If it is determined that the configuration has not been restored, the status code is sent to the host side to trigger the host side to resend the logical unit list query instruction until it is determined that each logical unit is restored to its configuration based on the latest status code, and then the timers of each thread are exited. The common service timer periodically determines whether the timers of each thread have exited; if it is determined that they have exited, it means that each logical unit has been restored to its configuration, ensuring that each logical unit executes the multiple instructions in the startup queue in sequence under the available stage, so that the host side generates the block device.
[0040] To enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0041] Combined with the specific application environment architecture or specific hardware architecture on which the execution of the method for delaying the generation of the block device depends, the specific application environment architecture or specific hardware architecture is described herein.
[0042] Reference Figure 1 , Figure 1 is a schematic diagram of the relationship between the logical unit and the host side provided by the embodiments of the present application; as Figure 1As shown in the figure, there are 6 logical units on the storage system, namely logical unit 0, logical unit 1, logical unit 2, logical unit 3, logical unit 4, and logical unit 5. The 6 logical units of the storage system are assigned to different host sides. Among them, logical unit 0, logical unit 1, and logical unit 2 are associated with host side A. Host side A can only query these 3 logical units and generate corresponding 3 block devices on host side A; logical unit 3, logical unit 4, and logical unit 5 are associated with host side B. Host side B can only query these 3 logical units and generate corresponding 3 block devices on host side B. After the storage system is started, the Small Computer System Interface (SCSI) kernel module of the operating system on the host side will automatically send SCSI commands to query the block devices provided by the storage system.
[0043] Reference Figure 2 , Figure 2 is a schematic diagram of the relationship between the storage system and the host side provided by the embodiment of the present application; as Figure 2 shown, the host side and the storage system are connected through a Fibre Channel (FC) switch. After the storage system is started, port B of the storage system and port A of the host side automatically establish a connection through the FC switch to build a communication link. After the connection is established, the SCSI kernel module of the host side operating system automatically initiates SCSI commands to query the available logical units from the storage system through the communication link. The storage system responds to the query and feeds back the logical unit information it provides to the host side. The host side generates corresponding block devices in the file system according to the received logical unit information, and each logical unit corresponds to an independent block device. The host side indirectly accesses the logical units of the storage system through the generated block devices. When writing data to the block device, the data will be stored in the corresponding logical unit; when reading data from the block device, it is actually to obtain data from the logical unit to achieve read and write operations on the storage system.
[0044] Figure 3 is a schematic flowchart of the method for generating block devices with delay provided by the embodiment of the present application. As Figure 3 shown, the embodiment of the present application provides a method for generating block devices with delay, and the method is described in detail as follows:
[0045] S301: Establish multiple communication links with the host side; one communication link corresponds to one thread.
[0046] In this embodiment, a communication link is established between a port on the storage system and a port on the host side.
[0047] Exemplarily, Figure 4 is a schematic diagram of thread operations of the storage system provided by the embodiment of the present applicationFigure 1 As shown Figure 4 in the figure, there are n + 1 communication links, corresponding to n + 1 threads, namely fibre-x, fibre-x + 1, ……, fibre-x + n respectively; optionally, there is also a common service thread in the storage system, namely slow-fibre, and the common service thread is used to process common tasks.
[0048] In this embodiment, each thread runs independently on a CPU core, each thread has a task list, and the thread continuously processes the tasks on the task list. Each thread can independently process different links.
[0049] S302: Receive multiple instructions sent by the host, where the multiple instructions include a logical unit list query instruction.
[0050] In this embodiment, the host logs in to the ports of the storage systems corresponding to the respective communication links. After successful login, it sends multiple instructions to the ports corresponding to the respective communication links.
[0051] In this embodiment, the common service thread restores the configurations of each logical unit and related configurations.
[0052] S303: Cache the multiple instructions to the startup queues of each thread.
[0053] In this embodiment, after the storage system is started, the host sequentially sends a device query instruction, a logical unit list query instruction, a critical product data query instruction, a port group data query instruction, and a capacity data query instruction to the storage system. The timing for executing the multiple instructions is as Figure 5 shown Figure 5 which is a timing schematic diagram of the storage system in the embodiment of the present application for executing multiple instructions. As Figure 5As shown in the figure, after the storage system sequentially executes the device query instruction, the logical unit list query instruction, the important product data query instruction, the port group data query instruction, and the capacity data query instruction, and returns the instruction execution results to the host in sequence, the host will generate a device block. Among them, the device query instruction is used to query the device data of the storage system, etc.; including data such as the manufacturer ID, product ID, and supported features of the storage system. Optionally, the supported features include whether functions such as Auto Contingent Allegiance (ACA) and Asymmetric Logical Unit Access (ALUA) are supported. The logical unit list query instruction is used to query the number of logical units in the storage system. The important product data query instruction is used to query the important product data of each logical unit, etc.; the port group data query instruction is used to query the port group data of each logical unit, etc.; the capacity data query instruction is used to query the capacity data of each logical unit, etc.
[0054] In this embodiment, since a large number of configurations need to be restored when the storage system starts up, which takes a long time, and the instruction execution time is short, it may complete the execution of instructions for each logical unit during the stage when the logical unit is unavailable, easily causing the host to fail to generate a block device and affecting business continuity. Therefore, to solve this problem, it is necessary to execute the logical unit list query instruction, the important product data query instruction, the port group data query instruction, and the capacity data query instruction after the configurations of each logical unit in the storage system are restored. Before the configurations of each logical unit in the storage system are restored, only the device query instruction is processed, and the logical unit list query instruction, the important product data query instruction, the port group data query instruction, and the capacity data query instruction are cached in the startup queue. In this embodiment, considering that a status code can be obtained after the storage system executes the logical unit list query instruction, it is possible to determine whether the logical unit has been configured based on this status code. Therefore, obtain the logical unit list query instruction from the startup queue, execute the logical unit list query instruction, obtain the status code, and determine whether each logical unit has been configured.
[0055] S304: Start the timers of each thread to periodically execute the logical unit list query instruction to obtain the status code.
[0056] Specifically, start the timers of each thread; set the scanning period of the timers of each thread; scan the startup queue periodically according to the scanning period to obtain the logical unit list query instruction in the startup queue; execute the logical unit list query instruction to obtain the status code.
[0057] In this embodiment, set the scanning period of the timers of each thread according to the expiration time of the logical unit list query instruction.
[0058] In this embodiment, as Figure 4 shown, n + 1 threads, fibre-x, fibre-x + 1, ……, fibre-x + n all start a timer to periodically execute the logical unit list query instruction.
[0059] In this embodiment, the expiration time of the logical unit list query instruction is 6 seconds. Optionally, the scan period can be set to 3 seconds, and it can be executed before the logical unit list query instruction times out and a preparation time is reserved.
[0060] Optionally, the scan period of the timer can be dynamically adjusted based on the storage system load. Specifically, monitor metrics such as the CPU utilization rate, memory occupancy rate, and I / O throughput of the storage system in real time. Exemplarily, when the storage system load is high, such as when the CPU utilization rate exceeds 80%, extend the scan period of each timer, which can be extended from 3 seconds to 5 seconds, reduce the consumption of system resources by high-frequency scanning, and avoid exacerbating the load pressure. If the system load is low, such as when the CPU utilization rate is below 30%, shorten the scan period of each timer, which can be shortened from 3 seconds to 2 seconds.
[0061] S305: According to the status code, determine whether each logical unit in the logical unit list has been restored to the configuration. If it is determined that the configuration has not been restored, send the status code to the host side so that the host side can resend the logical unit list query instruction according to the status code; until it is determined that each logical unit has been restored to the configuration according to the latest status code, exit the timers of each thread.
[0062] In this embodiment, the status code is a pre-set status code in the SCSI protocol. If the status code is 062900, it means that the storage system has been powered on but each logical unit has not been restored to the configuration. Send this status code to the host side so that the host side can trigger the retry mechanism and resend the logical unit list query instruction. Restart the timers of each thread to periodically execute the logical unit list query instruction to obtain the next status code. Until the latest status code obtained is not 062900, when it is determined that each logical unit has been restored to the configuration, exit the timers of each thread.
[0063] In this embodiment, as Figure 4 shown, if the status code is 062900, trigger the host side to resend the logical unit list query instruction until the status code is not 062900, indicating that each logical unit has been restored to the configuration, and each thread exits the timer.
[0064] In this embodiment, delay the execution time of multiple instructions in the startup queue to ensure that after each logical unit has been restored to the configuration, then execute multiple instructions in the startup queue, and avoid executing multiple instructions when each logical unit has not been restored to the configuration, which causes the host side to generate device blocks to fail and cannot provide services for the upper-layer services.
[0065] S306: Start the public service timer and periodically determine whether the timers of each thread have exited.
[0066] In this embodiment, step S306 is executed by the public service thread.
[0067] Specifically, step S306 includes S3061 to S3069:
[0068] S3061: Start the public service timer.
[0069] In this embodiment, the public service thread starts the public service timer.
[0070] S3062: Set the detection period of the public service timer.
[0071] In this embodiment, the detection period of the public service timer is set according to the expiration time of the device query instruction. Optionally, the detection period can be set to 20 seconds, that is, the public service timer detects whether the timers on fibre-x, fibre-x + 1,..., fibre-x + n have exited within the detection period of 20 seconds.
[0072] S3063: Divide the detection period into multiple sub-detection intervals; where the multiple sub-detection intervals are used to trigger the traversal operation periodically.
[0073] Optionally, the sub-detection interval can be set to every 5 seconds, that is, the traversal operation is triggered every 5 seconds.
[0074] S3064: When the public service timer reaches any sub-detection interval, trigger the traversal operation and traverse and access each thread in turn.
[0075] Exemplarily, when the public service timer reaches the 5th second, trigger the traversal operation and traverse and access each thread in turn.
[0076] S3065: Read the status flag of the timer of each thread.
[0077] In this embodiment, when the timer of each thread is running, it maintains a status flag that can be accessed externally, such as a flag bit in memory, with values of running or exited. When the public service thread traverses each thread, it reads the status flag of the timer of each thread.
[0078] S3066: According to the status flag, determine whether the timers of each thread have exited;
[0079] Specifically, step S3066 includes Sa to Sb:
[0080] Sa: If the status flag is exited, it is determined that the timers of each thread have exited.
[0081] Sb: If the status flag is not exited, the public service timer waits until the next sub-detection interval arrives.
[0082] Exemplarily, if at the 5th second when the public service timer arrives, a traversal operation is triggered, and during the process of traversing and accessing each thread in sequence, it is determined that the timers of each thread have not exited, then the public service timer waits until the next sub-detection interval arrives, that is, when the public service timer reaches the 10th second.
[0083] Specifically, step Sb includes Sb1~Sb2:
[0084] Sb1: When the public service timer reaches the next sub-detection interval, re-trigger the traversal operation and re-traverse and access each thread in sequence.
[0085] In this embodiment, when the public service timer reaches the 10th second, re-trigger the traversal operation and re-traverse and access each thread in sequence.
[0086] Sb2: Read the latest status flag of the timer of each thread until it is determined that the timers of each thread have exited according to the latest status flag.
[0087] S307: If it is determined that they have exited, then execute multiple instructions in the start queue in sequence to obtain an execution result.
[0088] In this embodiment, if it is determined that they have exited, it means that all logical units have been restored to their configurations.
[0089] In this embodiment, the multiple instructions include an important product data query instruction, a port group data query instruction, and a capacity data query instruction; the execution result includes important product data, port group data, and capacity data.
[0090] Specifically, execute the important product data query instruction to obtain important product data; execute the port group data query instruction to obtain port group data; execute the capacity data query instruction to obtain capacity data.
[0091] In this embodiment, the logical unit list query instruction is used to query the number of logical units in the storage system. The important product data query instruction is used to query the important product data of each logical unit, including the unique identification code of each logical unit; the port group data query instruction is used to query the port group data of each logical unit; the capacity data query instruction is used to query the capacity data of each logical unit.
[0092] S308: Send the execution result to the host side so that the host side generates a block device.
[0093] In summary, after the storage system is started, the host side will send multiple instructions. After the storage system sequentially executes multiple instructions, the host side will generate a block device. In this process, the time for executing multiple instructions is delayed through the status code to ensure that each logical unit executes multiple instructions when it has restored the configuration and is in the available stage. Specifically, when multiple instructions sent by the host side are received, the multiple instructions are cached in the startup queue. The instruction for querying the logical unit list is periodically executed through the timer of each thread to obtain the status code. Whether each logical unit has restored the configuration is judged according to the status code. If it is determined that the configuration has not been restored, the time for executing multiple instructions is delayed, and the status code is sent to the host side to trigger the host side to resend the instruction for querying the logical unit list until it is determined according to the latest status code that each logical unit has restored the configuration, and then the timer of each thread exits. The public service timer periodically judges whether the timer of each thread has exited; if it is determined that it has exited, it means that each logical unit has restored the configuration, ensuring that each logical unit sequentially executes multiple instructions in the startup queue in the available stage, so that the host side successfully generates a block device without affecting the business continuity. In addition, multiple threads are set, and one communication link corresponds to one thread. Each thread processes different communication links separately, and the tasks processed are relatively single, which can reduce the use of resource locks and improve the data processing speed.
[0094] Figure 6 Schematic diagram of thread operations of the storage system provided by the embodiment of the present application Figure 2 The above embodiment considers the case where the configuration restoration speed of each logical unit is relatively fast. In this embodiment, the case where the configuration restoration speed of each logical unit is relatively slow is introduced, that is, after starting the public service timer and periodically judging whether the timer of each thread has exited, there is a case where the timer of each thread has not exited, which is described in detail as follows:
[0095] S401: If it is determined that there is a timer of each thread that has not exited, restart the public service timer and periodically judge whether the timer of each thread has exited.
[0096] In this embodiment, as Figure 6 shown, if the public service determines within the detection period of 20 seconds that the timer of each thread has not exited, the public service thread restarts the public service timer and re-periodically judges whether the timer of each thread has exited.
[0097] S402: Within the preset number of restart times, if it is determined that there is a timer of each thread that has not exited, restart the public service timer multiple times and continuously periodically judge whether the timer of each thread has exited until it is determined that the timer of each thread has exited.
[0098] In this embodiment, if, after restarting the public service timer, when periodically determining whether the timers of each thread have exited and it is determined that there are still timers of each thread that have not exited, the public service timer is restarted again. This continues until it is determined within the preset number of restart times that the timers of each thread have exited.
[0099] In this embodiment, the number of restart times is preset according to the time for each logic unit to restore the configuration.
[0100] Exemplarily, the longest time for each logic unit to fully restore the configuration is 120 seconds, that is, the public service timer runs for at most 120 seconds, and the preset number of restart times is 5 times.
[0101] In this embodiment, if it is determined that they have exited, multiple instructions in the startup queue are sequentially executed to obtain an execution result. The execution result is sent to the host side so that the host side generates a block device.
[0102] In summary, when the public service timer periodically determines whether the timers of each thread have exited and there are timers of each thread that have not exited, the public service timer is restarted to re-determine whether the timers of each thread have exited until it is determined that the timers of each thread have exited. Considering the case where the speed of each logic unit to restore the configuration is slow, it is ensured that after each logic unit has restored the configuration, multiple instructions in the startup queue are sequentially executed to ensure that the host side successfully generates a block device.
[0103] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.
[0104] Figure 7 It is a schematic structural diagram of a block device delay generation device provided by an embodiment of the present application. As Figure 7 shown, an embodiment of the present application also provides a block device delay generation device, including: a establishment module 701, a reception module 702, a cache module 703, a startup module 704, an exit module 705, a judgment module 706, an execution module 707, and a generation module 708.
[0105] The establishment module 701 is used to establish multiple communication links with the host side; one communication link corresponds to one thread;
[0106] The reception module 702 is used to receive multiple instructions sent by the host side, and the multiple instructions include a logical unit list query instruction;
[0107] The cache module 703 is used to cache the multiple instructions into the startup queue of each thread;
[0108] The start module 704 is used to start the timers of each thread, periodically execute the logical unit list query instruction, and obtain the status code;
[0109] The exit module 705 is used to determine whether each logical unit in the logical unit list has been restored to the configuration according to the status code. If it is determined that the configuration has not been restored, the status code is sent to the host side so that the host side resends the logical unit list query instruction according to the status code; until it is determined that each logical unit has been restored to the configuration according to the latest status code, the timers of each thread are exited;
[0110] The judgment module 706 is used to start the public service timer and periodically judge whether the timers of each thread have exited;
[0111] The execution module 707 is used to, if it is determined that the timers have exited, sequentially execute multiple instructions in the start queue to obtain the execution result;
[0112] The generation module 708 is used to send the execution result to the host side so that the host side generates a block device.
[0113] In a possible implementation manner, the start module 704 includes:
[0114] The first start unit is used to start the timers of each thread;
[0115] The first setting unit is used to set the scanning period of the timers of each thread;
[0116] The scanning unit is used to scan the start queue at a fixed period according to the scanning period and obtain the logical unit list query instruction in the start queue;
[0117] The first execution unit is used to execute the logical unit list query instruction to obtain the status code.
[0118] In a possible implementation manner, the setting unit is specifically used to: set the scanning period of the timers of each thread according to the expiration time of the logical unit list query instruction.
[0119] In a possible implementation manner, the judgment module 706 includes:
[0120] The second start unit is used to start the public service timer;
[0121] The second setting unit is used to set the detection period of the public service timer;
[0122] The division unit is used to divide the detection period into multiple sub-detection intervals; wherein the multiple sub-detection intervals are used to trigger the traversal operation at a fixed period;
[0123] The first trigger unit is used to trigger a traversal operation when the public service timer reaches any sub-detection interval, and sequentially traverse and access each thread;
[0124] The first reading unit is used to read the status flag of the timer of each thread;
[0125] The first judgment unit is used to judge whether the timer of each thread has exited according to the status flag;
[0126] The first determination unit is used to determine that the timer of each thread has exited if the status flag is exited;
[0127] The waiting unit is used to wait for the public service timer to reach the next sub-detection interval if the status flag is not exited;
[0128] The second trigger unit is used to re-trigger a traversal operation when the public service timer reaches the next sub-detection interval, and re-sequentially traverse and access each thread;
[0129] The second reading unit is used to read the latest status flag of the timer of each thread until it is determined that the timer of each thread has exited according to the latest status flag.
[0130] In a possible implementation manner, the multiple instructions include an important product data query instruction, a port group data query instruction, and a capacity data query instruction; the execution results include important product data, port group data, and capacity data; correspondingly, the execution module 707 includes:
[0131] The second execution unit is used to execute the important product data query instruction to obtain important product data;
[0132] The third execution unit is used to execute the port group data query instruction to obtain port group data;
[0133] The fourth execution unit is used to execute the capacity data query instruction to obtain capacity data.
[0134] In a possible implementation manner, the delay generation device of the block device further includes a determination module, and the determination module includes:
[0135] The second judgment unit is used to restart the public service timer if it is determined that there is a timer of a thread that has not exited, and regularly judge whether the timer of each thread has exited;
[0136] The second determination unit is used to restart the public service timer multiple times within the preset restart times if it is determined that there is a timer of a thread that has not exited, and continuously regularly judge whether the timer of each thread has exited until it is determined that the timer of each thread has exited.
[0137] In a possible implementation, the delay generation device of the block device further includes a setting module, which is specifically configured to preset the number of restart times according to the time when each logical unit restores the configuration.
[0138] For the description of the features in the corresponding embodiment of the delay generation device of the block device, reference may be made to the relevant description in the corresponding embodiment of the delay generation method of the block device, which will not be elaborated here one by one.
[0139] Figure 8 It is a schematic structural diagram of the storage system provided by the embodiment of the present application. As Figure 8 shown, the storage system provided in this embodiment includes at least one processor 801 and a memory 802. Optionally, the storage system further includes a communication component 803. Among them, the processor 801, the memory 802, and the communication component 803 are connected through a bus.
[0140] In the specific implementation process, at least one processor 801 executes the computer execution instructions stored in the memory 802, so that at least one processor 801 executes the above-mentioned embodiment of the delay generation method of the block device.
[0141] For the specific implementation process of the processor 801, reference may be made to the above method embodiment, and its implementation principle and technical effect are similar, which will not be elaborated here in this embodiment.
[0142] In the above embodiment, it should be understood that the processor may be a central processing unit (Central Processing Unit, abbreviated as: CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, abbreviated as: DSP), application specific integrated circuits (Application Specific Integrated Circuit, abbreviated as: ASIC), etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the application can be directly implemented by the execution of the hardware processor, or can be implemented by the combination of hardware and software modules in the processor.
[0143] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0144] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the buses in the drawings of this application are not limited to only one bus or one type of bus.
[0145] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. Wherein, the computer program is configured to execute the steps in the embodiment of any of the above-mentioned delay generation methods for block devices when running.
[0146] In an exemplary embodiment, the above-mentioned computer-readable storage medium may include, but is not limited to: various media that can store computer programs such as USB flash drives, read-only memories (ROM for short), random access memories (RAM for short), mobile hard disks, magnetic disks, or optical discs.
[0147] An embodiment of the present application also provides a computer program product. The above-mentioned computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in the embodiment of any of the above-mentioned delay generation methods for block devices.
[0148] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in the embodiment of any of the above-mentioned delay generation methods for block devices.
[0149] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0150] The above has introduced in detail a method, device, storage system, and storage medium for delaying generation of a block device provided in this application. Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art of this technology, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A method for generating latency of a block device, characterized in that Including: Establishing multiple communication links with the host side; one communication link corresponds to one thread; Receiving multiple instructions sent by the host side, where the multiple instructions include a logical unit list query instruction; Caching the multiple instructions into the startup queues of each thread; Starting the timers of each thread, and periodically executing the logical unit list query instruction to obtain a status code; According to the status code, determining whether each logical unit in the logical unit list has been restored to its configuration. If it is determined that the configuration has not been restored, sending the status code to the host side so that the host side resends the logical unit list query instruction according to the status code; until it is determined that each logical unit has been restored to its configuration according to the latest status code, exiting the timers of each thread; Starting a public service timer, and periodically determining whether the timers of each thread have exited; If it is determined that they have exited, sequentially executing the multiple instructions in the startup queue to obtain an execution result; Sending the execution result to the host side so that the host side generates a block device.
2. The method according to claim 1, wherein The starting the timers of each thread, and periodically executing the logical unit list query instruction to obtain a status code includes: Starting the timers of each thread; Setting the scanning period of the timers of each thread; According to the scanning period, periodically scanning the startup queue to obtain the logical unit list query instruction in the startup queue; Executing the logical unit list query instruction to obtain a status code.
3. The method according to claim 2, characterized in that, The setting the scanning period of the timers of each thread includes: Setting the scanning period of the timers of each thread according to the expiration time of the logical unit list query instruction.
4. The method according to claim 1, wherein The starting the public service timer, and periodically determining whether the timers of each thread have exited includes: Starting the public service timer; Setting the detection period of the public service timer; Dividing the detection period into multiple sub-detection intervals; where the multiple sub-detection intervals are used to periodically trigger a traversal operation; When the public service timer reaches any sub-detection interval, triggering a traversal operation and sequentially traversing and accessing each thread; Reading the status flag of the timer of each thread; According to the status flag, determining whether the timers of each thread have exited; If the status flag is "exited", determining that the timers of each thread have exited; If the status flag is "not exited", the public service timer waits until the next sub-detection interval; When the public service timer reaches the next sub-detection interval, re-triggering the traversal operation and re-sequentially traversing and accessing each thread; Reading the latest status flag of the timer of each thread until it is determined that the timers of each thread have exited according to the latest status flag.
5. The method according to claim 1, characterized in that, The multiple instructions include an important product data query instruction, a port group data query instruction, and a capacity data query instruction; the execution result includes important product data, port group data, and capacity data; Correspondingly, the sequentially executing the multiple instructions in the startup queue to obtain an execution result includes: Executing the important product data query instruction to obtain the important product data; Execute the port group data query instruction to obtain the port group data; Execute the capacity data query instruction to obtain the capacity data.
6. The method according to claim 1, wherein After starting the public service timer and periodically determining whether the timers of the respective threads have exited, it further includes: If it is determined that there are timers of the respective threads that have not exited, restart the public service timer and periodically determine whether the timers of the respective threads have exited; Within the preset number of restart times, if it is determined that there are timers of the respective threads that have not exited, restart the public service timer multiple times and continuously periodically determine whether the timers of the respective threads have exited until it is determined that the timers of the respective threads have exited.
7. The method according to claim 6, characterized in that, Before restarting the public service timer, it further includes: Preset the number of restart times according to the time when the respective logic units are restored to the configuration.
8. A delay generation device for a block device, characterized in that, It includes: A establishing module, configured to establish multiple communication links with the host side; one communication link corresponds to one thread; A receiving module, configured to receive multiple instructions sent by the host side, where the multiple instructions include a logical unit list query instruction; A caching module, configured to cache the multiple instructions into the startup queues of the respective threads; A starting module, configured to start the timers of the respective threads and periodically execute the logical unit list query instruction to obtain a status code; An exiting module, configured to determine, according to the status code, whether each logical unit in the logical unit list has been restored to the configuration. If it is determined that the configuration has not been restored, send the status code to the host side so that the host side resends the logical unit list query instruction according to the status code; until it is determined that each logical unit has been restored to the configuration according to the latest status code, exit the timers of the respective threads; A judging module, configured to start a public service timer and periodically judge whether the timers of the respective threads have exited; An executing module, configured to, if it is determined that they have exited, sequentially execute the multiple instructions in the startup queue to obtain an execution result; A generating module, configured to send the execution result to the host side so that the host side generates a block device.
9. A storage system, characterized in that, It includes: A memory, configured to store a computer program; A processor, configured to implement the steps of the method for delayed generation of a block device according to any one of claims 1-7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, where the computer program, when executed by a processor, implements the steps of the method for delayed generation of a block device according to any one of claims 1-7.
Citation Information
Cited By
Block device generation method, storage system and server
CN120929023A