A method and device for controlling login and logout of an NVMe system, and a medium
By judging the target result of the access command in the NVMe system and deleting or retaining the opposite command, the problem of inconsistency between the host-side link status and message notification is solved, and stable login/logout control of the NVMe system is realized.
Patent Information
- Application Number
- CN202310265806.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-17
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2043-03-17
AI Technical Summary
In NVMe systems, the host-side automatic connection device receives port online/offline notifications continuously within a very short period of time, causing inconsistencies between the link connection status and the notification messages, making it difficult to handle effectively.
By acquiring access commands sent by external storage devices that are not the first access command, it is determined whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed. If they are the same, all access commands to be executed are deleted; if they are different, one access command with the opposite target result to the currently executing access command is retained.
This ensures the consistency between the host-side link status and the message notification reception sequence, reduces the pressure on the NVMe system, and solves the problem of receiving multiple login/logout message notifications in a very short period of time.
Smart Images

Figure CN116302610B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a login / logout control method, device, and medium for an NVMe system. Background Technology
[0002] Nonvolatile Memory Express (NVMe) is an interface specification currently used in storage devices. NVMe hard drives improve system storage performance while providing massive storage capacity. In an NVMe over RDMA link topology, to enable automatic and rapid connection establishment between the host and storage, a switch typically acts as an intermediary, notifying the host-side automatic connection device of the storage port information. The host-side automatic connection device then interacts with the NVMe system based on the notification, queries the corresponding link status, and issues login / logout operations. To ensure link effectiveness and high bandwidth, each NVMe link between the host and storage is a point-to-point connection between the host port's Internet Protocol Address (IP) and the storage port's IP address within the service domain.
[0003] The automatic connection device on the host side issues login / logout operations to the NVMe system via message notifications sent by the switch. Due to network latency, and the time required for both the automatic connection device and the switch to process network packets, the automatic connection device on the host side may receive online or offline notifications for the same storage port IP address consecutively within a short period (e.g., 1-2 seconds). Additionally, during fault testing, such as rapid plugging and unplugging of network cables, the automatic connection device on the host side may receive an offline notification first, followed by a online notification, at the same time.
[0004] Therefore, how to handle the continuous receipt of port online / offline notifications within a short period of time and ensure that the final connection status of the host-side link is consistent with the notification is a technical problem that urgently needs to be solved by those in the field. Summary of the Invention
[0005] The purpose of this application is to provide a login and logout control method for an NVMe system that receives continuous port online / offline notifications.
[0006] To address the aforementioned technical problems, this application provides an NVMe system login / logout control method, comprising:
[0007] Retrieve the latest access command (not the first one) sent by the external storage device;
[0008] Determine whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed;
[0009] If they are the same, delete all pending access commands;
[0010] If they are different, then retain an access command that is the opposite of the target result of the access command being executed.
[0011] Preferably, in the above-described NVMe system login / logout control method, before determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed, the method further includes:
[0012] Parse the access command;
[0013] The access command is added to the command cache queue, which includes an execution area and a waiting area; the execution area and the waiting area store one access command.
[0014] If the access command represents a login command, then set the status flag to 1;
[0015] If the access command indicates a logout operation, then the status flag is set to 0.
[0016] Preferably, in the above-described NVMe system login / logout control method, determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed includes:
[0017] If an access command has been written to the execution area and the waiting area is empty, determine whether the target result of the current access command is the same as the target result of the access command being executed.
[0018] If they are different, correspondingly, retain an access command that is the opposite of the target result of the currently executed access command, including:
[0019] Write the current access command to the waiting area;
[0020] If they are the same, correspondingly delete all pending access commands, including:
[0021] Delete the currently accessed command.
[0022] Preferably, in the above-described NVMe system login / logout control method, determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed includes:
[0023] If both the execution area and the waiting area have been written with an access command, determine whether the target result of the current access command is the same as the target result of the access command being executed.
[0024] If they are different, correspondingly, retain an access command that is the opposite of the target result of the currently executed access command, including:
[0025] Delete the currently accessed command;
[0026] If they are the same, correspondingly delete all pending access commands, including:
[0027] Delete the current access command and the access command in the waiting area.
[0028] Preferably, in the above-described NVMe system login / logout control method, the access command is added to the command cache queue, including:
[0029] The access command is added to the command cache queue corresponding to the external storage device and stored redundantly at the same time.
[0030] Preferably, in the above-mentioned NVMe system login and logout control method, the command cache queue is an array structure.
[0031] Preferably, in the above-described NVMe system login / logout control method, before obtaining a non-first access command sent by the external storage device, the method further includes:
[0032] Obtain the first access command sent by the external storage device;
[0033] Use the Internet Protocol address of the external storage device as the key to mark the empty storage unit in the array structure;
[0034] The access command is written to the execution area of the storage unit.
[0035] To address the aforementioned technical problems, this application also provides an NVME system login / logout control device, comprising:
[0036] The acquisition module is used to acquire the latest access command sent by the external storage device that is not the first one.
[0037] The judgment module is used to determine whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed;
[0038] The first processing module is used to delete all pending access commands if they are the same.
[0039] The second processing module is used to retain an access command that is the opposite of the target result of the currently executed access command if they are not the same.
[0040] To address the aforementioned technical problems, this application also provides an NVME system login / logout control device, comprising:
[0041] Memory, used to store computer programs;
[0042] The processor is used to implement the steps of the above-described NVME system login and logout control method when executing computer programs.
[0043] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned NVME system login / logout control method.
[0044] The NVMe system login / logout control method provided in this application includes: obtaining the latest (not the first) access command sent by the external storage device; determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed; if they are the same, deleting all access commands to be executed; if they are different, retaining an access command with a target result opposite to that of the currently executing access command. This method only requires determining whether the target result of the latest access command is the same as the target result of the currently executing access command, ensuring the validity of the command. It solves the problem of the host issuing login / logout commands to the NVMe system in scenarios where the host receives multiple login / logout message notifications consecutively within a very short period, effectively reducing the pressure on the NVMe system, while ensuring that the host-side link status is consistent with the message notification reception sequence.
[0045] In addition, this application also provides an apparatus and a medium that correspond to the above method and have the same effect. Attached Figure Description
[0046] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 A flowchart illustrating an NVMe system login / logout control method provided in this application embodiment;
[0048] Figure 2 This application provides a schematic diagram illustrating the connection between an NVMe system and an external storage device.
[0049] Figure 3 A structural diagram of an NVME system login / logout control device provided in this application embodiment;
[0050] Figure 4 This is a structural diagram of another NVME system login / logout control device provided in an embodiment of this application. Detailed Implementation
[0051] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0052] The core of this application is to provide a login and logout control method, device, and medium for an NVMe system.
[0053] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0054] NVMe is a method for linking and transferring data between a host and a target storage system, designed for use with faster storage media (such as flash memory) that have non-volatile memory. This type of storage enables low latency, low central processing unit (CPU) utilization, and high performance, and is often used as an alternative to Small Computer System Interface (SCSI) storage.
[0055] NVMe storage can be directly connected to a host via a PCIe interface, or it can be connected via different architectures and transmission media, such as NVMe over Fabric (NVMe-OF) and NVMe over RDMA (Remote Direct Memory Access, RDMA over Converged Ethernet, RoCE) version 2. NVMe over RDMA technology enables data exchange between two systems on a network using Remote Direct Memory Access (RDMA), bypassing the operating system or the processor of either system.
[0056] NVMe technology is in its early stages of development, and its stability needs further improvement. In addition, the host and storage cannot automatically establish a connection, do not support plug-and-play, and have relatively poor usability.
[0057] In an NVMe over RDMA link topology, to enable automatic and rapid connection establishment between the host and storage, a switch typically acts as an intermediary, notifying the host-side automatic connection device of the storage port information. The host-side automatic connection device then interacts with the NVMe system based on the notification, queries the corresponding link status, and issues login / logout operations. To ensure link effectiveness and high bandwidth, each NVMe link between the host and storage is a point-to-point connection between the host port IP and the storage port IP within the service domain.
[0058] The host-side automatic connection device sends login / logout operations to the NVMe system via message notifications from the switch. Due to network latency and the time required for both the host-side automatic connection device and the switch to process network packets, the host-side automatic connection device may receive notifications of the same storage port IP address coming online or going offline consecutively within a short period (e.g., 1-2 seconds). Furthermore, during fault testing, such as rapid plugging and unplugging of network cables, the host-side automatic connection device may receive a logout notification first, followed by a logon notification, all within the same timeframe. Effectively handling message notifications, managing and controlling the login / logout commands sent to the NVMe system, and ensuring that the final connection state of the host-side link remains consistent with the message notifications in scenarios involving consecutive port online / offline notifications within a very short timeframe is a significant challenge in current automatic connection implementations.
[0059] To address the aforementioned challenges, this invention proposes a login / logout control method for NVMe systems, such as... Figure 1 As shown, it includes:
[0060] S11: Obtain the latest access command (not the first one) sent by the external storage device;
[0061] S12: Determine whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed;
[0062] S13: If they are the same, delete all pending access commands;
[0063] S14: If they are not the same, retain an access command that is the opposite of the target result of the access command being executed.
[0064] Figure 2 This application provides a schematic diagram illustrating the connection between an NVMe system and an external storage device, as shown in the embodiment. Figure 2As shown, when an external storage device logs in or out, or when the link between the host and the external storage device fails, the switch needs to send the status information of the external storage device port to the host port in the form of message packets. The host port's automatic connection device receives the message packets sent by the switch, parses them, and performs corresponding operations. Therefore, when the external storage device connects to the host or disconnects from the host, it sends a login / logout notification to the switch. The switch converts the login / logout notification sent by the external storage device into message packets and sends the message packets to the automatic connection device on the host side. This application embodiment is implemented based on the automatic connection device. The access command mentioned in this application embodiment refers to the external storage device login or logout command.
[0065] In addition, the non-first access command mentioned in this embodiment refers to a non-first access command sent by an external storage device to the host within a specified time period. The following steps are performed to determine this, for example, starting from the time the host is powered on, the non-first access command sent by the external storage device to the host.
[0066] When a non-first access command is received, it is determined whether the target result of the currently executing access command is the same as the target result of the access command to be executed. That is, if the currently executing access command is login and the newly received access command is logout, it is determined to be different; if the newly received access command is also login, it is determined to be the same.
[0067] If they are the same, all pending access commands are deleted. This is because there may be other access commands between the currently executing access command and the newly received access command. Since the final result is the same, all pending access commands except the currently executing access command can be deleted. For example, if the currently executing access command is "login," and a "logout" access command was received in the previous judgment period, the second access command will be retained as a pending access command. If the third access command, i.e., the latest received access command, is also "login," then the final result is "login." To avoid duplicate operations, all pending access commands except the currently executing access command are deleted.
[0068] If they are different, then retain the access command whose target result is opposite to that of the currently executing access command. This is because there may be other access commands between the currently executing access command and the newly received access command. For example, if the currently executing access command is "login," and a "logout" access command was received in the previous judgment period, then the second access command will be retained as the access command to be executed. If the third access command, i.e., the latest received access command, is also "logout," then the execution results of the second and third access commands are the same, and only one needs to be retained. To avoid duplicate operations, retain the access command whose target result is opposite to that of the currently executing access command; that is, delete either the second or third, and retain the other. Preferably, the third is deleted.
[0069] Additionally, if a large number of login and logout commands are received in a short period of time, the same judgment can be made. If the currently executing access command is login and the last access command is also login, then all pending access commands except the currently executing access command can be directly deleted. If the currently executing access command is login and the last access command is logout, then one access command with the opposite target result to the currently executing access command is retained, and other pending access commands are deleted. Only the latest access command and the currently executing access command need to be compared, reducing data calculation.
[0070] The NVMe system login / logout control method provided in this application includes: obtaining the latest access command (not the first one) sent by the external storage device; determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed; if they are the same, deleting all the access commands to be executed; if they are different, retaining an access command whose target result is opposite to that of the currently executing access command. This method only requires determining whether the target result of the latest access command is the same as the target result of the currently executing access command, ensuring the validity of the command. It solves the problem of the host issuing login / logout commands to the NVMe system in scenarios where the host receives multiple login / logout message notifications consecutively within a very short time, effectively reducing the pressure on the NVMe system, while ensuring that the host-side link status is consistent with the message notification reception sequence.
[0071] According to the above embodiments, this embodiment provides a preferred solution. Before determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed, the above NVMe system login / logout control method further includes:
[0072] Parse the access command;
[0073] The access command is added to the command cache queue, which includes an execution area and a waiting area; the execution area and the waiting area store one access command.
[0074] If the access command represents a login command, then set the status flag to 1;
[0075] If the access command indicates a logout operation, then the status flag is set to 0.
[0076] The access command is parsed and written to a command cache queue, which includes an execution area and a waiting area. Each area stores an access command. If the access command represents a login command, a status flag is set to 1; if it represents a logout operation, the status flag is set to 0. For example, if the currently executing access command is login and the latest received access command is logout, the status flags of the execution area and the waiting area of the command cache queue are 1 and 0 respectively. The access command in the current execution area is executed first, and after execution, the access command in the waiting area is written to the execution area. Through the scheme provided in this application embodiment, the type of the currently executing access command can be determined by the status flag. Preferably, the command cache queue is an array structure.
[0077] Based on the above embodiments, this embodiment provides a preferred solution. The above-described NVMe system login / logout control method, which determines whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed, includes:
[0078] If an access command has been written to the execution area and the waiting area is empty, determine whether the target result of the current access command is the same as the target result of the access command being executed.
[0079] If they are different, correspondingly, retain an access command that is the opposite of the target result of the currently executed access command, including:
[0080] Write the current access command to the waiting area;
[0081] If they are the same, correspondingly delete all pending access commands, including:
[0082] Delete the currently accessed command.
[0083] In this embodiment, if an access command has been written to the execution area and the waiting area is empty, it is determined whether the target result of the current access command is the same as the target result of the currently executing access command. For example, if the access command currently being executed in the execution area is "Login" (status flag 1), and the latest access command is "Login" (status flag 1), then the current access command is deleted. If the access command currently being executed in the execution area is "Login" (status flag 1), and the latest access command is "Logout" (status flag 0), then an access command with a target result opposite to that of the currently executing access command is retained (i.e., the latest access command), and written to the waiting area. Subsequently, regardless of how many message notifications are received, they can be sent according to the type of the currently executing command (login or logout) and the command sending control design described above. A command cache queue of length 2 is sufficient to meet the requirements.
[0084] Based on the above embodiments, this embodiment provides a specific preferred solution. The above NVMe system login / logout control method, which determines whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed, includes:
[0085] If both the execution area and the waiting area have been written with an access command, determine whether the target result of the current access command is the same as the target result of the access command being executed.
[0086] If they are different, correspondingly, retain an access command that is the opposite of the target result of the currently executed access command, including:
[0087] Delete the currently accessed command;
[0088] If they are the same, correspondingly delete all pending access commands, including:
[0089] Delete the current access command and the access command in the waiting area.
[0090] In this embodiment, if both the execution area and the waiting area have an access command written to them, it is determined whether the target result of the current access command is the same as the target result of the currently executing access command. According to the above embodiment, the status flags of the execution area and the waiting area of the command cache queue have two possibilities: 10 or 01. For example, if the status flags of the execution area and the waiting area are 10, and the latest received access command is login (status flag 1), then all pending access commands are deleted, i.e., the latest received access command and the access commands in the waiting area are deleted. If the latest received access command is logout (status flag 0), which is the same as the command written to the waiting area, then an access command with a target result opposite to that of the currently executing access command is retained, i.e., the current access command is deleted. Subsequently, no matter how many message notifications are received, they can be issued according to the type of the currently executed command (login or logout) and the command issuance control design described above. A command cache queue of length 2 is sufficient to meet the requirements.
[0091] To prevent information loss, this embodiment provides a preferred solution: the above-mentioned NVMe system login / logout control method adds access commands to a command cache queue, including:
[0092] The access command is added to the command cache queue corresponding to the external storage device and stored redundantly at the same time.
[0093] After the access command is written to the command cache queue, it is synchronously and redundantly stored to prevent information loss.
[0094] According to the above embodiments, in the preferred embodiment of receiving the first access command, before obtaining a non-first access command sent by the external storage device, the method further includes:
[0095] Obtain the first access command sent by the external storage device;
[0096] Use the Internet Protocol address of the external storage device as the key to mark the empty storage unit in the array structure;
[0097] The access command is written to the execution area of the storage unit.
[0098] If the received access command is the first one sent by the external storage device, then the empty storage unit in the array structure is marked using the Internet Protocol address of the external storage device as the key, and the access command is written into the execution area of the storage unit. This storage unit is then used as the storage unit for access commands of the external storage device.
[0099] The above embodiments have described the NVME system login / logout control method in detail. This application also provides embodiments corresponding to the NVME system login / logout control device. It should be noted that this application describes the device embodiments from two perspectives: one based on functional modules and the other based on hardware.
[0100] From the perspective of functional modules Figure 3 A structural diagram of an NVME system login / logout control device provided in this application embodiment is shown below. Figure 3 As shown, the NVME system login / logout control device includes:
[0101] The acquisition module 31 is used to acquire the latest access command sent by the external storage device that is not the first one;
[0102] The judgment module 32 is used to determine whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed; if they are the same, the first processing module 33 is triggered; if they are different, the second processing module 34 is triggered.
[0103] The first processing module 33 is used to delete all pending access commands;
[0104] The second processing module 34 is used to retain an access command that is the opposite of the target result of the access command being executed.
[0105] Specifically, the acquisition module 31 is used to acquire the latest access command sent by the external storage device (not the first one); the judgment module 32 is used to determine whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed; if they are the same, the first processing module 33 is triggered to delete all the access commands to be executed; if they are different, the second processing module 34 is triggered to retain an access command with a target result opposite to that of the currently executing access command. By simply determining whether the target result of the latest access command is the same as the target result of the currently executing access command, the validity of the command is ensured. This solves the problem of the host issuing login / logout commands to the NVMe system in scenarios where the host receives multiple login / logout message notifications in a very short period of time, effectively reducing the pressure on the NVMe system, while ensuring that the host-side link status is consistent with the message notification reception sequence.
[0106] In addition, the device also includes:
[0107] The parsing subunit is used to parse access commands;
[0108] The add sub-unit is used to add the access command to the command cache queue, which includes an execution area and a waiting area; wherein the execution area and the waiting area store one access command.
[0109] If the access command represents a login command, then set the status flag to 1;
[0110] If the access command indicates a logout operation, then the status flag is set to 0.
[0111] The first judgment subunit is used to determine whether the target result of the current access command is the same as the target result of the access command being executed if an access command has been written into the execution area and the waiting area is empty.
[0112] If they are different, the first write sub-unit is triggered to write the current access command into the waiting area;
[0113] If they are the same, the first deletion sub-unit is triggered to delete the currently accessed command.
[0114] The second judgment subunit is used to determine whether the target result of the current access command is the same as the target result of the access command being executed if both the execution area and the waiting area have been written with an access command.
[0115] If they are different, the second deletion sub-unit is triggered to delete the currently accessed command;
[0116] If they are the same, the third deletion sub-unit is triggered to delete the current access command and the access command in the waiting area.
[0117] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.
[0118] Figure 4 A structural diagram of another NVME system login / logout control device provided in this application embodiment is shown below. Figure 4 As shown, the NVME system login / logout control device includes: a memory 40 for storing computer programs;
[0119] The processor 41 is used to execute a computer program to implement the steps of the method for obtaining user operation habit information as described in the above embodiment (NVME system login and logout control method).
[0120] The NVME system login / logout control device provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.
[0121] The processor 41 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 41 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 41 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 41 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 41 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.
[0122] The memory 40 may include one or more computer-readable storage media, which may be non-transitory. The memory 40 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 40 is used to store at least the following computer program 401, which, after being loaded and executed by the processor 41, is capable of implementing the relevant steps of the NVME system login / logout control method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 40 may also include an operating system 402 and data 403, and the storage method may be temporary or permanent storage. The operating system 402 may include Windows, Unix, Linux, etc. The data 403 may include, but is not limited to, the data involved in implementing the NVME system login / logout control method.
[0123] In some embodiments, the NVME system login / logout control device may further include a display screen 42, an input / output interface 43, a communication interface 44, a power supply 45, and a communication bus 46.
[0124] Those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on the NVME system login and logout control device and may include more or fewer components than shown.
[0125] The NVMe system login / logout control device provided in this application includes a memory and a processor. When the processor executes a program stored in the memory, it can implement the following method: NVMe system login / logout control method, including: obtaining the latest non-first access command sent by the external storage device; determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed; if they are the same, deleting all access commands to be executed; if they are different, retaining an access command with a target result opposite to that of the currently executing access command. It only needs to determine whether the target result of the latest access command is the same as the target result of the currently executing access command to ensure the validity of the command. This solves the problem of the host issuing login / logout commands to the NVMe system in scenarios where the host receives multiple login / logout message notifications consecutively within a very short period, effectively reducing the pressure on the NVMe system, while ensuring that the host-side link status is consistent with the message notification reception sequence.
[0126] Finally, this application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above embodiment of the NVME system login / logout control method.
[0127] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0128] The computer-readable storage medium provided in this embodiment stores a computer program. When the processor executes the program, it can implement the following method: an NVMe system login / logout control method, including: obtaining the latest non-first access command sent by the external storage device; determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed; if they are the same, deleting all the access commands to be executed; if they are different, retaining an access command with a target result opposite to that of the currently executing access command. This method only requires determining whether the target result of the latest access command is the same as the target result of the currently executing access command, ensuring the validity of the command. It solves the problem of the host issuing login / logout commands to the NVMe system in scenarios where the host receives multiple login / logout message notifications consecutively within a very short period, effectively reducing the pressure on the NVMe system, while ensuring that the host-side link status is consistent with the message notification reception sequence.
[0129] The NVMe system login / logout control method, apparatus, and medium provided in this application have been described in detail above. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
[0130] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A login / logout control method for an NVMe system, characterized in that, include: Retrieve the latest access command (not the first one) sent by the external storage device; Parse the access command; The access command is added to a command cache queue, which includes an execution area and a waiting area; wherein, the execution area and the waiting area store one access command. If the access command represents a login command, the status flag is set to 1; if the access command represents a logout operation, the status flag is set to 0. Determine whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed; the currently executing access command is the access command stored in the execution area; If they are the same, then delete all the access commands to be executed; If they are not the same, then retain an access command that is the opposite of the target result of the access command being executed; After the access command in the execution area is executed, the access command in the waiting area is written into the execution area; The step of determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed includes: if the execution area has been written with an access command and the waiting area is empty, determining whether the target result of the current access command is the same as the target result of the currently executing access command. If they are different, correspondingly, retaining an access command that is opposite to the target result of the currently executed access command includes: writing the current access command into the waiting area; If they are the same, correspondingly, deleting all the access commands to be executed includes: deleting the current access command; The step of determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed includes: if both the execution area and the waiting area have been written with an access command, determining whether the target result of the current access command is the same as the target result of the currently executing access command; If they are different, correspondingly, retaining an access command that is opposite to the target result of the currently executed access command includes: deleting the current access command; If they are the same, correspondingly, deleting all the access commands to be executed includes: deleting the current access command and the access commands in the waiting area.
2. The NVMe system login / logout control method according to claim 1, characterized in that, Adding the access command to the command cache queue includes: The access command is added to the command cache queue corresponding to the external storage device and stored redundantly at the same time.
3. The NVMe system login / logout control method according to claim 1, characterized in that, The command cache queue is an array structure.
4. The NVMe system login / logout control method according to claim 3, characterized in that, Before obtaining the latest access command (not the first one) sent by the external storage device, the method further includes: Obtain the access command sent by the external storage device for the first time; The empty storage units in the array structure are marked using the Internet Protocol address of the external storage device as the key. The access command is written into the execution area of the storage unit.
5. An NVMe system login / logout control device, characterized in that, include: The acquisition module is used to acquire the latest access command sent by the external storage device that is not the first one. A parsing subunit is used to parse the access command; A sub-unit is added to add the access command to a command cache queue, which includes an execution area and a waiting area. If the access command represents a login command, then the status flag is set to 1; If the access command represents a logout operation, then the status flag is set to 0; The judgment module is used to determine whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed; If they are the same, the first processing module is triggered; if they are different, the second processing module is triggered. The access command being executed is the access command stored in the execution area; The first processing module is used to delete all the access commands to be executed; The second processing module is configured to retain an access command that is the opposite of the target result of the access command being executed; After the access command in the execution area is executed, the access command in the waiting area is written into the execution area; The step of determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed includes: if the execution area has been written with an access command and the waiting area is empty, determining whether the target result of the current access command is the same as the target result of the currently executing access command. If they are different, correspondingly, retaining an access command that is opposite to the target result of the currently executed access command includes: writing the current access command into the waiting area; If they are the same, correspondingly, deleting all the access commands to be executed includes: deleting the current access command; The step of determining whether the target result of the currently executing access command is the same as the target result of the latest access command to be executed includes: if both the execution area and the waiting area have been written with an access command, determining whether the target result of the current access command is the same as the target result of the currently executing access command; If they are different, correspondingly, retaining an access command that is opposite to the target result of the currently executed access command includes: deleting the current access command; If they are the same, correspondingly, deleting all the access commands to be executed includes: deleting the current access command and the access commands in the waiting area.
6. An NVMe system login / logout control device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the NVMe system login / logout control method as described in any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the NVMe system login / logout control method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Device control method, device, electronic device, and storage medium
CN109725540A
NVMe system interaction method, apparatus and device, and readable medium
CN115129628A