Method and apparatus for generating operational commands for multiple storage device versions
By establishing an index structure for command sets, function sets, and version sets, the problem of increased complexity in storage management tools under multiple device versions is solved, achieving efficient operation command processing and device version management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MEMBLAZE TECH BEIJING
- Filing Date
- 2022-03-31
- Publication Date
- 2026-06-23
Smart Images

Figure CN114968357B_ABST
Abstract
Description
Technical Field
[0001] This application relates to computer technology, and in particular, to a method for generating operating commands for various versions of information processing devices. Background Technology
[0002] Figure 1A A block diagram of a solid-state storage device (SSD) is shown. The SSD 102 is coupled to a host computer to provide storage capabilities. The host computer and the SSD 102 can be coupled in various ways, including but not limited to connections via SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIe (Peripheral Component Interconnect Express), NVMe (NVM Express), Ethernet, Fibre Channel, and wireless communication networks. The host computer can be an information processing device capable of communicating with the storage device via the above methods, such as a personal computer, tablet computer, server, laptop computer, network switch, router, cellular phone, or personal digital assistant. Storage device 102 includes interface 103, control unit 104, one or more NVM chips 105, and DRAM (Dynamic Random Access Memory) 110.
[0003] NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), XPoint memory, etc. are common NVMs.
[0004] Interface 103 is compatible with exchanging data with the host via methods such as SATA, IDE, USB, PCIe, NVMe, SAS, Ethernet, and Fibre Channel.
[0005] The control unit 104 is used to control data transfer between the interface 103, the NVM chip 105, and the DRAM 110. It is also used for memory management, host logical address to flash physical address mapping, erase leveling, bad block management, etc. The control unit 104 can be implemented in various ways, including software, hardware, firmware, or a combination thereof. For example, the control unit 104 can be in the form of an FPGA (Field-programmable gate array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control unit 104 may also include a processor or controller, in which software executes to manipulate the hardware of the control unit 104 to process I / O (Input / Output) commands. The control unit 104 can also be coupled to the DRAM 110 and can access the data in the DRAM 110. FTL tables and / or cached I / O command data can be stored in the DRAM.
[0006] The control unit 104 includes a flash interface controller (or media interface, media interface controller, flash channel controller), which is coupled to the NVM chip 105 and issues commands to the NVM chip 105 in accordance with the interface protocol of the NVM chip 105 to operate the NVM chip 105, and receives the command execution results output from the NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI", etc.
[0007] The storage device stores the main firmware and boot firmware. The control unit 104 loads and executes the firmware to handle I / O commands and implement other functions of the storage device. The firmware is software that runs on, for example, the processor of storage device 104. The boot firmware is stored, for example, in NOR flash memory (not shown) of storage device 102. Upon power-up, the control unit loads and executes the boot firmware from a designated address in the NOR flash memory. The boot firmware is executed to initialize the various components of the storage device and to load the main firmware. The main firmware is stored, for example, in an NVM chip. To improve reliability, multiple images or copies of the main firmware are stored in the NVM chip. In response to loading the main firmware, the boot firmware transfers control to the main firmware.
[0008] Storage devices comprise multiple NVM chips. Each NVM chip comprises one or more dies (DIEs) or logic units (LUNs). Read and write operations can be performed in parallel across dies or logic units. Multiple read, write, or erase operations on the same die or logic unit are executed sequentially.
[0009] Figure 1B A schematic diagram illustrating the coupling between the host and the storage device is shown.
[0010] The host runs storage management software. For NVMe storage devices, the storage management tool is, for example, the nvme-cli tool available online (https: / / github.com / linux-nvme / nvme-cli). It issues NVMe commands to the storage device based on user-specified operation commands and obtains the execution results. In addition to NVMe commands, the storage device also supports other commands not defined in the NVMe protocol. For clarity, the commands provided to the storage device by the storage management tool are called storage commands, while the commands provided to the storage device by the user are called operation commands. The storage device receives and processes the storage commands and provides the execution results to the host. The storage management tool retrieves the execution results of the storage commands and, for example, displays them to the user.
[0011] Storage devices come in various versions. Figure 1B The V1, V2, and V3 shown represent different versions of storage devices, such as storage devices developed at different times or different versions of the NVMe protocol. Different versions of storage devices may support slightly different storage commands; therefore, storage management tools need to provide corresponding methods for generating and receiving storage commands for each storage device version.
[0012] Figure 1C This diagram illustrates how storage management tools maintain various storage commands for different storage device versions.
[0013] The storage management tool includes a command implementation function library. This library contains multiple command implementation functions (denoted as Func1, Func2, ..., Func6). The storage management tool generates the storage command CMD1 for storage device V1 by calling the command implementation function Func1. The command implementation function Func1 is also used to receive the processing results of the storage command CMD1 from storage device V1.
[0014] exist Figure 1C In the example, both storage device V1 and storage device V2 support the storage command CMD1 (the storage command CMD1 supported by storage devices V1 and V2 has the same command name (“CMD1”)). However, the storage command CMD1 of storage devices V1 and V2 has different forms, parameters, meanings, and / or processing procedures. Therefore, in the command implementation function library, different functions Func1 and Func2 are used to generate the storage command CMD1 of storage device V1 and storage device V2, respectively. Similarly, in the command implementation function library, a different function Func3 is provided to generate the storage command CMD1 of storage device V3.
[0015] Still there Figure 1C In the example, storage device V1 also supports storage commands CMD2 and CMD3, but these two commands are not supported in storage devices V2 and V3. Therefore, there are no corresponding functions for these two commands in the command implementation library. The function Func6 in the command implementation library is used to generate the storage command CMD4 for storage device V2.
[0016] Figure 1D The flowchart illustrates how a storage management tool generates management commands based on user-input commands.
[0017] Users input operation commands into the storage management tool through, for example, the console of the host operating system, such as mgr[version][cmd-name][paras], where mgr represents the name of the storage management tool, [version] indicates the version of the storage device, [cmd-name] indicates the name of the operation command, and [paras] indicates the parameters of the operation command. [paras] is not required.
[0018] The storage management tool retrieves the storage device version and the command name from the input command. Based on these two parameters, it searches for the corresponding command implementation function in the command implementation library and calls that function to process the command. Optionally, it also provides `paras` to the command implementation function. Summary of the Invention
[0019] As the number of storage device versions increases, the command implementation libraries for storage management tools also become increasingly large. See also... Figure 1C The same storage command may be handled the same or different ways in different storage device versions, and different storage devices may support the same or different types of storage commands. The handling of storage commands for the same storage device may also be updated. These factors contribute to the increasing complexity of storage management tools. Furthermore, the modifications required when adding new operation commands and / or storage commands become increasingly complex. As complexity increases, maintaining storage management tools becomes increasingly difficult. Therefore, it is desirable for storage management tools to effectively maintain the handling of various storage commands across multiple storage device versions, thereby reducing the complexity of maintaining the storage management tool itself.
[0020] According to a first aspect of this application, a method for processing operation commands of multiple device versions according to the first aspect of this application is provided, comprising: obtaining an operation command; obtaining a device version and a command name from the operation command; querying a command set using the command name to obtain a command index; querying a command version set using the command index and the device version to obtain a command version index; querying a command implementation function set using the command index and the command version index to obtain a command implementation function; and calling the obtained command implementation function to process the operation command.
[0021] According to the first method for processing operation commands of multiple device versions according to the first aspect of this application, a second method for processing operation commands of multiple device versions according to the first aspect of this application is provided, wherein the command set includes multiple entries, and the entries of the command set record the command names of operation commands supported by multiple device versions; when querying the command set by command name, the index of the entry recording the command name in the command set is used as the command index corresponding to the command name.
[0022] According to the first or second method for processing operation commands for multiple device versions according to the first aspect of this application, a third method for processing operation commands for multiple device versions according to the first aspect of this application is provided, wherein the command version set includes multiple entries, the entries of the command version set record a command version index set; the elements of the command version index set record the command version index corresponding to the device version; when querying the command version set using the command index and the device version, the command index is used as the index of the command version set to obtain the first entry, and the element corresponding to the device version is obtained from the command version index set recorded in the first entry as the command version index.
[0023] According to the third method for processing operation commands of multiple device versions according to the first aspect of this application, a fourth method for processing operation commands of multiple device versions according to the first aspect of this application is provided, wherein the device version obtained from the operation command is mapped to a numerical value; and the mapped numerical value is used as an index to obtain the corresponding element from the command version index set of the first entry record.
[0024] According to the third or fourth method for processing operation commands of multiple device versions according to the first aspect of this application, a fifth method for processing operation commands of multiple device versions according to the first aspect of this application is provided, wherein one or more elements in a single command version index set are the same, such that the command implementation functions corresponding to one or more device versions among the multiple device versions corresponding to the single command version index set are the same.
[0025] According to one of the methods for processing operation commands for multiple device versions according to the third to fifth aspects of the first aspect of this application, a sixth method for processing operation commands for multiple device versions according to the first aspect of this application is provided, wherein one or more elements in a single command version index set are different, such that the command implementation functions corresponding to one or more device versions among the multiple device versions corresponding to the single command version index set are different.
[0026] According to one of the methods for processing operation commands for multiple device versions according to the third to fifth aspects of the first aspect of this application, a method for processing operation commands for multiple device versions according to the seventh aspect of the first aspect of this application is provided, wherein one or more elements in the command version index set are null or specified values to indicate that there is no corresponding command implementation function; in response to querying the command version set with the command index and the device version, if the obtained command version index is the null or specified value, it indicates that the operation command cannot be processed.
[0027] According to one of the methods for processing operation commands for multiple device versions according to the first to seventh aspects of the first aspect of this application, an eighth method for processing operation commands for multiple device versions according to the first aspect of this application is provided, wherein the command implementation function set includes multiple entries, and the entries of the command implementation function set record a command implementation function index set; the elements of the command implementation function index set record command implementation function indices, and the elements in the command implementation function index set are indexed by the command version index; when querying the command implementation function set using the command index and the command version index, the command index is used as the index of the command implementation function set to obtain a second entry, and the element corresponding to the command version index is obtained from the command implementation function index set recorded in the second entry as the command implementation function index, and the command implementation function index represents a callable command implementation function.
[0028] According to the eighth method of processing operation commands for multiple device versions according to the first aspect of this application, a ninth method of processing operation commands for multiple device versions according to the first aspect of this application is provided, wherein the number of elements in the command implementation function index set is less than or equal to the number of the multiple device versions.
[0029] According to one of the methods for processing operation commands of multiple device versions according to the first to ninth aspects of the first aspect of this application, a tenth method for processing operation commands of multiple device versions according to the first aspect of this application is provided, wherein the operation command further includes one or more parameters; when the obtained command implementation function is called, the one or more parameters are provided to the command implementation function.
[0030] According to one of the methods for processing operation commands of multiple device versions according to the first to tenth aspects of the first aspect of this application, an eleventh method for processing operation commands of multiple device versions according to the first aspect of this application is provided, further comprising: in response to adding a processable first operation command, if the first operation command is a new operation command, adding the command name of the first operation command to a command set, and obtaining the index of the first operation command in the command set as a first command index; adding a third entry indexed by the first command index to a command implementation function set, recording the command implementation function index of the command implementation function of the first operation command in the third entry, and obtaining the index of the command implementation function index of the first operation command in the third entry; adding a fourth entry indexed by the first command index to a command version set, and adding an element in the fourth entry whose value is the index of the command implementation function index of the first operation command in the third entry, and whose device version index supporting the first operation command is the index of the command implementation function index of the first operation command in the third entry.
[0031] According to the eleventh method of processing operation commands for multiple device versions according to the first aspect of this application, a twelfth method of processing operation commands for multiple device versions according to the first aspect of this application is provided, further comprising: if the first operation command is an existing operation command, obtaining the index of the first operation command in the command set as a second command index; if the command implementation function of the first operation command is a new command implementation function, obtaining a fourth entry in the command implementation function set using the second command index, adding the index of the new command implementation function to the command implementation function index set recorded in the fourth entry, and obtaining the index of the new command implementation function in the command implementation function index set recorded in the fourth entry; obtaining a fifth entry in the command version set using the second command index, and recording the index of the new command implementation function in the command implementation function index set recorded in the fourth entry in the element corresponding to the device version of the first operation command in the command version index set of the fifth entry.
[0032] According to the twelfth method of processing operation commands for multiple device versions according to the first aspect of this application, a thirteenth method of processing operation commands for multiple device versions according to the first aspect of this application is provided, further comprising: if the command implementation function of the first operation command is an existing command implementation function and is applicable to the new device version, obtaining a fourth entry in the command implementation function set using a second command index, obtaining the index of the existing command implementation function in the command implementation function index set recorded in the fourth entry; obtaining a fifth entry in the command version set using the second command index, adding an element corresponding to the new device version of the first operation command in the command version index set of the fifth entry, and recording the index of the existing command implementation function in the command implementation function index set recorded in the fourth entry in the element.
[0033] According to a second aspect of this application, a method for a first management operation command according to the second aspect of this application is provided, comprising: in response to adding a processable first operation command, if the first operation command is a new operation command, adding the command name of the first operation command to a command set, and obtaining the index of the first operation command in the command set as a first command index; adding a third entry indexed by the first command index to a command implementation function set, recording the command implementation function index of the command implementation function of the first operation command in the third entry, and obtaining the index of the command implementation function index of the first operation command in the third entry; adding a fourth entry indexed by the first command index to a command version set, and adding an element in the fourth entry whose value is the index of the command implementation function index of the first operation command in the third entry, and whose device version index supporting the first operation command is the index of the command implementation function index of the first operation command.
[0034] According to the method for the first management operation command of the second aspect of this application, a method for the second management operation command according to the second aspect of this application is provided, further comprising: if the first operation command is an existing operation command, obtaining the index of the first operation command in the command set as a second command index; if the command implementation function of the first operation command is a new command implementation function, obtaining a fourth entry in the command implementation function set using the second command index, adding the index of the new command implementation function to the command implementation function index set recorded in the fourth entry, and obtaining the index of the new command implementation function in the command implementation function index set recorded in the fourth entry; obtaining a fifth entry in the command version set using the second command index, and recording the index of the new command implementation function in the command implementation function index set recorded in the fourth entry in the element corresponding to the device version of the first operation command in the command version index set of the fifth entry.
[0035] According to the method for the second management operation command of the second aspect of this application, a method for the third management operation command of the second aspect of this application is provided, further comprising: if the command implementation function of the first operation command is an existing command implementation function and is applicable to a new device version, obtaining a fourth entry in the command implementation function set using a second command index, obtaining the index of the existing command implementation function in the command implementation function index set recorded in the fourth entry; obtaining a fifth entry in the command version set using the second command index, adding an element corresponding to the new device version of the first operation command in the command version index set of the fifth entry, and recording the index of the existing command implementation function in the command implementation function index set recorded in the fourth entry in the element.
[0036] According to a third aspect of this application, an information processing apparatus is provided, including a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that the processor executes the program to implement a method according to one of the first and second aspects of this application. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0038] Figure 1A A block diagram of a solid-state storage device is shown.
[0039] Figure 1B A schematic diagram illustrating the coupling between the host and the storage device is shown;
[0040] Figure 1C The diagram illustrates how storage management tools maintain various storage commands for different storage device versions.
[0041] Figure 1D This demonstrates a flowchart showing how a storage management tool generates management commands based on user-input operations.
[0042] Figure 2A A schematic diagram illustrating a command set of a storage management tool according to an embodiment of this application is provided.
[0043] Figure 2B A schematic diagram illustrating the set of command implementation functions of a storage management tool according to an embodiment of this application is shown;
[0044] Figure 2C A schematic diagram illustrating a set of command versions of a storage management tool according to embodiments of this application is provided.
[0045] Figure 3 A flowchart illustrating the processing of operation commands by a storage management tool according to an embodiment of this application is shown;
[0046] Figure 4A A flowchart illustrating the addition of new supported operation commands to a storage management tool according to an embodiment of this application is shown;
[0047] Figure 4B , 4C The same as 4D respectively showed Figure 4A The corresponding command set, command implementation function set, and command version set;
[0048] Figure 5AA flowchart illustrating the modification of command implementation functions for existing operation commands supported by a storage management tool, according to an embodiment of this application, is provided.
[0049] Figure 5B , 5C Showing the same as 5D Figure 5A The corresponding command set, command implementation function set, and command version set;
[0050] Figure 6A A flowchart illustrating a new operation command for adding a supported new storage device version to a storage management tool according to an embodiment of this application;
[0051] Figure 6B , 6C The same as 6D respectively showcased the same Figure 6A The corresponding command set, command implementation function set, and command version set;
[0052] Figure 7A A flowchart illustrating an embodiment of this application is provided to add supported existing operation commands for a new storage device version to a storage management tool.
[0053] Figure 7B , 7C Showing the same as 7D Figure 7A The corresponding command set, command implementation function set, and command version set;
[0054] Figure 8A A flowchart illustrating how to add supported existing operation commands for new storage device versions to a storage management tool and modify its command implementation function according to embodiments of this application is shown; and
[0055] Figure 8B , 8C The same as 8D were displayed. Figure 8A The corresponding set of commands, the set of command implementation functions, and the set of command versions. Detailed Implementation
[0056] 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, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0057] Figure 2A A schematic diagram illustrating a set of commands for a storage management tool according to an embodiment of this application is shown.
[0058] A command set is a data structure used by storage management tools. Command sets are provided by methods such as arrays, linear lists, linked lists, and hash tables. A command set records multiple entries, each indicating an associated index and command name. For every operation command supported by the storage management tool, its name is recorded in the command set. If the same command name has different meanings in different storage device versions, only a single command name is recorded in the command set. Therefore, each command name appears exactly once in the command set (occupying one entry).
[0059] exist Figure 2A In the example, the command set records six command names (get-a, set-a, get-b, set-b, identify, reset). The command name recorded in the corresponding entry can be retrieved using the index of the command set entry. In an operation command such as mgr[version][cmd-name][paras], [cmd-name] indicates the command name, such as "get-a" or "reset".
[0060] Optionally, the entries in the command set also record descriptive information corresponding to the command name, which records, for example, the function and usage of the command.
[0061] According to embodiments of this application, when a storage management tool needs to add support for new operation commands, an entry is added to the command set to record the name of the new operation command. However, if the existing operation commands supported by the storage management tool are changed without changing their names, it is not necessary to add an entry to the command set, or even change the existing entries in the command set.
[0062] Figure 2B A schematic diagram illustrating the set of command implementation functions of a storage management tool according to an embodiment of this application is shown.
[0063] The command implementation function set is a data structure used by storage management tools. It records multiple entries, each indicating an associated index and a set of command implementation function indices. Therefore, the elements of the command implementation function set are still sets.
[0064] For each command implementation function maintained by the storage management tool, there is a record in the command implementation function set. The command implementation function set records, for example, the index (e.g., pointer or reference) of the command implementation function, so that the storage management tool can call the corresponding command implementation function to process the operation command by using the index of the command implementation function.
[0065] The index of the set of functions that implement commands is called the command index. The command index is the same as... Figure 2A The displayed command set is associated with an index. For example, in the command set (see...) Figure 2A If the index of the command named "get-b" is "2", then using "2" as the command index, the entries obtained from the command implementation function set will show two corresponding command implementation function indices (Func2-1 and Func2-2). Therefore, for a user-input command, the index of the entry corresponding to that command name is found in the command set as the command index. Using this command index, the command implementation function set is accessed, and the corresponding command implementation function is guaranteed to be recorded in that entry obtained from the command implementation function set.
[0066] See Figure 2B When a command name has multiple command implementation functions, each of the multiple command implementation functions is recorded in the entry of the command implementation function set indicated by the command index corresponding to the command name.
[0067] The number of command implementation function indices can vary across entries in the command implementation function set. For example, see... Figure 2B For command index 0, its corresponding entry records 3 command implementation function indices; for command index 1, its corresponding entry records 1 command implementation function index; for command index 4, its corresponding entry is an empty set, meaning there is no corresponding command implementation function. The storage management tool can recognize that the entry set of command implementation functions is an empty set, and thus prompt the user that the corresponding command name is not supported.
[0068] The entries in the command implementation function set are command implementation function index sets. The command implementation function index set records zero, one, or more command implementation function indices, each corresponding to a different storage device version that provides the command. Based on the storage device version, the corresponding element (the command implementation function applicable to that specific command name for that storage device version) is retrieved from the command implementation function index set, and the operation command indicated by that command name is processed by calling the corresponding command implementation function.
[0069] Figure 2C A schematic diagram illustrating a set of command versions of a storage management tool according to embodiments of this application is provided.
[0070] Command version sets are data structures used by storage management tools. A command version set records multiple entries, each indicating an associated index and command version index set. Therefore, the elements of a command version set are still sets.
[0071] For each storage device version maintained by the storage management tool, there is a record in the command version set. The command version index set records the value corresponding to each storage device version.
[0072] The index of the command version set is called the command index. The command index is the same as... Figure 2A The displayed command set is associated with an index. For example, in the command set (see...) Figure 2A If the command named "get-b" has an index of "2", then using "2" as the command index, the entries obtained in the command version set record the values corresponding to the various storage device versions associated with "get-b". See also... Figure 2C The entries in the same command version set with command index "2" are [V1-2], [V2-2], [V3-2], and [V4-2]. Here, "[V1-2]" represents the value corresponding to storage device version V1 for command index "2," while "[V4-2]" represents the value corresponding to storage device version V4 for command index "2." The value [V4-2] is used for indexing. Figure 2B The command implementation function index set in the document will be described in detail later.
[0073] Continue reading Figure 2C The elements of the command version index set are in the form of [Vx-i], which represents a numerical value used as an index, such as 0, 1, 2, etc. "[Vx-i]" where Vx represents the storage device version Vx, and i represents the command index associated with it. Therefore, the entry with index i in the command version set is the command version index set {[V1-i],[V2-i],[V3-i],[V4-i]}, where the four elements are the values corresponding to storage device versions V1, V2, V3, and V4, respectively.
[0074] In one example, the command version index set is an array. The array indices are defined by the storage device versions supported by the storage management tool. When the storage management tool supports M storage device versions, the number of elements in the array representing the command version index set is M. For example, for command index i, the element in the command version index set indexed by storage device version Vx is the value corresponding to storage device version Vx. If a storage device version does not support the command represented by command index i, the element corresponding to that storage device version in the entry supported by index i in the command version set will be, for example, null.
[0075] In another example, the command version index set is a linked list, where each node records the storage device version Vx and its corresponding value [Vx-i]. For a command name with command index i, if the storage device version Vx supports that command name, then...<Vx,[Vx-i]> It appears in the entry at index i of the command version set; if the storage device version Vx does not support the command name, then...<Vx,[Vx-i]> It does not appear in the entry at index i of the command version set.
[0076] In yet another example, the command version index set is a lookup table, the storage device version Vx serves as the index of the lookup table entry, and the value [Vx-i] corresponding to the storage device version Vx is the value of the lookup table entry.
[0077] Therefore, for the command name of the operation command input by the user, the index of the entry corresponding to the command name is found in the command set as the command index. The command version set is accessed using the command index to obtain the entry of the command version set. The storage device version indicated in the operation command is used to find the corresponding value from the entry. This value is used as the index of the entry corresponding to the command index in the command implementation function set to obtain the corresponding command implementation function.
[0078] By providing a set of command versions, operation commands with the same command name can have different command implementation functions in different storage device versions. Thus, operation commands with the same command name can have different implementation methods or functions in different storage device versions.
[0079] According to embodiments of this application, if a storage management tool needs to add support for a new storage device version, a value indexed by the new storage device version is added to one or more elements of the command version set. This value serves as an index to the command implementation function index set. When the storage management tool needs to support a new storage device version, in addition to providing command implementation functions applicable to the new storage device version for each command name, an index for the command implementation function for the new storage device version is added to each entry of the command implementation function set, and a command version index for the new storage device version is added to the command version index set of each entry of the command version set. The value of the command version index is used to index the newly added command implementation function index in the command implementation function index set.
[0080] Figure 3 A flowchart illustrating the processing of operation commands by a storage management tool according to an embodiment of this application is shown.
[0081] Users operate storage management tools on the host machine, entering operation commands into the tools. Operation commands have a form such as `mgr[version][cmd-name][paras]`, where `[version]` indicates the storage device version, and `[cmd-name]` indicates the command name. Understandably, operation commands can have other forms. As a concrete example, the operation command is `mgrV2 get -b`.
[0082] The storage management tool extracts the storage device version and command name from the operation command. For example, the storage device version in the operation command is "V2" and the command name is "get-b". The storage management tool uses the obtained command name to query the command set to obtain the command index corresponding to that command name. For example, for the command name "get-b", see also... Figure 2A In the command set, the command name has a command index of "2".
[0083] Continue reading Figure 3 Use the obtained command index (e.g., "2") and the storage device version (e.g., "V2") to query the command version set. See also Figure 2C For example, using command index "2", we obtain the command version index set "[V1-2],[V2-2],[V3-2],[V4-2]" from the command version set. Similarly, using storage device version "V2", we obtain the corresponding element "[V2-2]" from this command version index set "[V1-2],[V2-2],[V3-2],[V4-2]", which serves as the command version index. For example, the element "[V2-2]" is an integer with a value of 1 (called the command version index, which serves as the index of the command implementation function index set).
[0084] Continue reading Figure 3 Use the obtained command index (e.g., "2") and command version index (element "[V2-2]", value 1) to query the set of command implementation functions. See also Figure 2B For example, the command implementation function index set "Func2-1,func2-2" is obtained from the command implementation function set using the command index "2". The element "func2-2" with index "[V2-2]" (value 1) is obtained from the command implementation function index set "Func2-1,func2-2" as the command implementation function index using the command version index ("[V2-2]", value 1). Then, the corresponding command implementation function is called through the command implementation function index "func2-2" to process the operation command "mgrV2 get-b".
[0085] Optionally, the operation command also has a parameter "[paras]". The storage management tool provides the parameter "[paras]" to the command implementation function corresponding to the command implementation function index "func2-2" without requiring any further processing of the parameter.
[0086] Optionally, the command version index obtained from the command version set may be null or a specified value, which means that for the current operation command provided by the user, the storage device version indicated by the operation command does not support the command name indicated by the current operation command, so the storage management tool terminates the processing of the operation command and prompts the user with an error message, for example.
[0087] According to embodiments of this application, operation commands for multiple storage device versions can correspond to the same command implementation function, so that the elements corresponding to each storage device version in the command version index set corresponding to a certain command index have the same value, thereby indexing the same index in the command implementation function index set.
[0088] Figure 4A A flowchart illustrating the addition of new supported operation commands to a storage management tool according to an embodiment of this application is shown.
[0089] Figure 4B , 4C The same as 4D respectively showed Figure 4A The corresponding set of commands, the set of command implementation functions, and the set of command versions.
[0090] When a new command (named "new_CMD") is added to a storage device in version V, the storage management tools need to support the processing of this new command. The function index for the implementation of this new command is denoted as "Func_new_CMD".
[0091] For this purpose, we search the command set to see if the name of the new command exists in the command set. Since "new_CMD" is a new command, it does not exist in the command set. Therefore, we add an entry to the command set to record the command name "new_CMD" and obtain the index of the newly added entry as the command index. See also Figure 4B The latest entry is recorded at the very end of the command set, with its index (command index) being "New_Index" and the value of the entry being the command name "new_CMD".
[0092] Return to view Figure 4A Next, a new entry is added to the command implementation function set to record the command implementation function index "Func_new_CMD" for the new command, and the index of this new entry is set to the command index ("New_Index") obtained by adding the previous entry to the command set. See also Figure 4CThe latest entry is recorded at the end of the command implementation set, with its index (command index) being "New_Index" and its value being the command implementation function index "Func_new_CMD". Understandably, the value of each entry in the command implementation function set is a set, and the command implementation function index "Func_new_CMD" is an element of that set. According to embodiments of this application, even if the command implementation function of the new command "new_CMD" is the same as a command implementation function already managed by the storage management tool, when adding a new command, a new entry is added to the command implementation function set, and the index of the command implementation function is recorded in the new entry, instead of using an existing entry that already records that index.
[0093] Continue reading Figure 4A Next, a new entry is added to the command version set to record the command version index set of the new command, and the index of this new entry is the command index ("New_Index") obtained by adding the entry to the command set previously. Since the command name "new_CMD" represents a new command, currently only supported in storage device version V, the command version index set of the entry with index "New_Index" in the command version set contains only a single element. This element represents the index of the command implementation function of the operation command named "New_Index" for storage device version V, within the element of the command implementation function set (command implementation function index set). See also... Figure 4D The latest entry is recorded at the very end of the command implementation set, with its index (command index) being "New_Index". The entry's value "[V-New_index]" (e.g., equal to 0) indicates the... Figure 4C The element Func_new_CMD with the value "[V-New_index]" in the set of command implementation function indexes for the entry with index "New_Index" is the corresponding command implementation function index.
[0094] Understandably, the entries in the command version set (the command implementation function index set) are a set, and the value "[V-New_index]" is an element of the set. The value "[V-New_index]" in the command implementation function index set can be indexed by the storage device version V. Figure 4D In "[V-New_index]", the "V" before the "-" indicates that the element can be indexed by "V". Optionally, elements corresponding to other storage device versions are also added to the command implementation function index set. Since these storage device versions do not yet support the new command, the elements corresponding to other storage device versions are set to a specified value (e.g., "(E)") in the command implementation function index set. By recognizing the specified value, the storage management tool knows that these storage device versions do not yet support the new command.
[0095] Figure 5A A flowchart illustrating a function for changing the command implementation of existing operation commands supported by a storage management tool, according to an embodiment of this application, is provided.
[0096] Figure 5B , 5C Showing the same as 5D Figure 5A The corresponding set of commands, the set of command implementation functions, and the set of command versions.
[0097] Simply put, when updating the command implementation function of an operation command, modification of the command implementation function itself is sufficient without changing the command set, the command implementation function set, or the command version set. Alternatively, if a new command implementation function is provided, only the command implementation function index in the command implementation function set needs to be changed. However, in some cases, the same command implementation function is used for operation commands on different storage device versions, or the same command implementation function is used for different operation commands, and updating the command operation function only applies to some, not all, storage device versions or some, not all, operation commands. In these cases, simply changing the command implementation function index in the command implementation function set cannot change the command implementation function for existing operation commands supported by the storage management tool.
[0098] See Figure 5A A new command implementation function (e.g., func_b) is provided for the operation commands of storage devices in version V1 (whose command name is "set-b"). The storage management tool needs to add management of this command implementation function func_b.
[0099] For this purpose, we search the command set to see if the command name of the operation exists in the command set. Since "set-b" is an existing command, we find the command name in the command set and obtain its index (3) in the command set as the command index (see also...). Figure 5B The command name for the entry with index 3 is "set-b".
[0100] Next, retrieve the corresponding entry from the command implementation function set using the previously obtained command index (3), whose old value is the set "Func3" (see...). Figure 5C The entry with index 3. A new command implementation function (func_b) is added to the command implementation function index set represented by this entry. Furthermore, when adding the command implementation function index "func_b" to the command implementation function index set represented by this entry, it is also known that the index of the command implementation function index "func_b" in this set is 1 (the index of element "Func3" is 0).
[0101] Next, retrieve the corresponding entry from the command version set using the previously obtained command index (3), whose old value is the set "[V1-3],[V2-3],[V3-3],[V4-3]". In the command version index set represented by this entry, update the element ([V1-3]) corresponding to storage device version V1, and update this element to the index (1) of the command implementation function index "func_b" in the command implementation function index set (see) Figure 5D (The entry with index 3).
[0102] This completes the update of the storage management tool. When you enter the command "mgrV1set -b" into the storage management tool again, the tool will call the newly added command implementation function "func_b" through the command implementation function index "func_b".
[0103] Figure 6A A flowchart illustrating a new operation command for adding a supported new storage device version to a storage management tool according to an embodiment of this application is shown.
[0104] Figure 6B , 6C The same as 6D respectively showcased the same Figure 6A The corresponding set of commands, the set of command implementation functions, and the set of command versions.
[0105] When storage management tools need to support new commands (named "new_CMD") for new storage device versions Vw, the storage management tools need to support the processing of these new commands. The function index for the implementation of this new command is denoted as "Func_new_CMD".
[0106] For this purpose, we search the command set to see if the name of the new command exists in the command set. Since "new_CMD" is a new command, it does not exist in the command set. Therefore, we add an entry to the command set to record the command name "new_CMD" and obtain the index of the newly added entry as the command index. See also Figure 6B The latest entry is recorded at the very end of the command set, and its index (command index) is "New_Index".
[0107] Next, a new entry is added to the command implementation function set to record the command implementation function index "Func_new_CMD" for the new command, and the index of this new entry is set to the command index ("New_Index") obtained by adding the previous entry to the command set (see [link]). Figure 6CUnderstandably, the value of an entry in the set of command implementation functions is a set, the command implementation function index "Func_new_CMD" is an element of the set, and the index of that element in the set is retrieved (e.g., 0 or a determinable specified value).
[0108] Next, a new entry is added to the command version set to record the command version index set of the new command, and the index of this new entry is the command index ("New_Index") obtained by adding the entry to the command set earlier. In the command version set of the entry with index "New_Index", an element ([Vw-New_index]) is added (see...). Figure 6D This element represents the index of the command implementation function index "Func_new_CMD" in the entry with index "New_Index" in the command implementation function set (the command implementation function index set), and this element ([v-New_index]) is indexable by the storage device version Vw in the command version index set. Optionally, elements corresponding to other storage device versions are also added to the entry with index "New_Index" in the command version set. Since these other storage device versions do not yet support the operation command corresponding to the command name "new_CMD", these elements corresponding to other storage device versions are set to, for example, null or a specified value (E). Figure 6D (Not shown).
[0109] Optionally, if an operation command is added for the first time for storage device version Vw, elements corresponding to storage device version Vw are also added to other entries in the command version set (entries whose index is not "New_Index"). These elements are indexed by storage device version Vw in the command version index set, and their values are, for example, null values to indicate that storage device version Vw does not yet support the operation command corresponding to its entry.
[0110] Figure 7A A flowchart illustrating an embodiment of this application is provided, showing how to add supported existing operation commands for new storage device versions to a storage management tool.
[0111] Figure 7B , 7C Showing the same as 7D Figure 7A The corresponding set of commands, the set of command implementation functions, and the set of command versions.
[0112] For existing commands, use the existing command implementation functions to process them, without adding new command implementation functions to the command implementation function library, so as to avoid code redundancy and inconsistencies caused by subsequent updates.
[0113] See Figure 7AAdds support for the existing operation command (named "reset") in the storage management tool for storage device version Vw. The command implementation function for the operation command ("reset") is also existing (e.g., "Func5").
[0114] For this purpose, we search the command set to see if the command name of the operation command exists in the command set. Since "reset" is an existing command, we find the command name in the command set and obtain its index (5) in the command set as the command index (see also...). Figure 7B The command name for the entry with index 5 is "reset".
[0115] Next, retrieve the corresponding entry from the command implementation function set using the previously obtained command index (5), whose value is the set "Func5" (see [link]). Figure 7C The entry with index 5 is used to locate the index ("Func5") of the command implementation function for the operation command ("reset") to be added, and the index of that command implementation function within the command implementation function index set. Figure 7C In the example, "Func5" is the only element in the set of function indices of the command implementation it belongs to, so its index is, for example, 0 or a definite specified value.
[0116] Next, retrieve the corresponding entry from the command version set using the previously obtained command index (5), whose value is the set "[V1-5],[V2-5],[V3-5],[V4-5]". In the command version index set represented by this entry, add the element corresponding to the storage device version Vw ([Vw-5]), and set its value to the index of "Func5" in the command implementation function index set (e.g., 0 or a definite specified value). Figure 7D In the example, it is shown as a value of 0 ([Vw-5] = 0).
[0117] This completes the update of the storage management tool. When the operation command "mgrVwreset" is entered into the storage management tool, the tool will use the command implementation function index "Func5" to process the operation command "reset" for storage device version Vw.
[0118] Figure 8A A flowchart illustrating an embodiment of this application is provided, showing how to add supported existing operation commands for new storage device versions to a storage management tool and modify its command implementation function.
[0119] Figure 8B , 8C The same as 8D were displayed. Figure 8AThe corresponding set of commands, the set of command implementation functions, and the set of command versions.
[0120] In some cases, new storage device versions support existing operation commands, but the way these commands are handled is different from before. In such cases, new command implementation functions need to be added to the command implementation function library to handle the existing operation commands submitted to the new storage device version.
[0121] See Figure 8A Adds support for an existing operation command (named "reset") in the storage management tool for storage device version Vw, where the command implementation function for the operation command ("reset") is new (e.g., "Func_new").
[0122] For this purpose, we search the command set to see if the command name of the operation command exists in the command set. Since "reset" is an existing command, we find the command name in the command set and obtain its index (5) in the command set as the command index (see also...). Figure 8B The command name for the entry with index 5 is "reset".
[0123] Next, retrieve the corresponding entry from the command implementation function set using the previously obtained command index (5), with the value being the set "Func5". Add the command implementation function index "Func_new" of the new command implementation function (Func_new) to the command implementation function index set represented by this entry (see...). Figure 8C Furthermore, when adding the command implementation function index "Func_new" to the set of command implementation function indices represented by this entry, it is also known that the index of the command implementation function index "Func_new" in this set is 1 (the index of the element "Func5" is 0).
[0124] Next, retrieve the corresponding entry from the command version set using the previously obtained command index (5), whose old value is the set "[V1-5],[V2-5],[V3-5],[V4-5]". In the command version index set represented by this entry, add the element corresponding to the storage device version Vw ([Vw-5]), and set its value to the index of "Func_new" in the command implementation function index set (e.g., 1, ...). Figure 8D In the example, it is shown as [Vw-5]=1).
[0125] This completes the update of the storage management tool. When the operation command "mgrVwreset" is entered into the storage management tool, the tool will use the command implementation function index "Func_new" to process the operation command "reset" for storage device version Vw.
[0126] Optionally, if an operation command is added for the first time for storage device version Vw, elements corresponding to storage device version Vw are also added to other entries in the command version set (entries with an index other than 5). These elements are indexed by storage device version Vw in the command version index set, and their values are, for example, null values to indicate that storage device version Vw does not yet support the operation command corresponding to its entry.
[0127] Understandably, the above examples illustrate how storage management tools process various operation commands for storage devices and how command implementation functions handle them. However, the technical solution of this application is not limited to storage devices, but can be used to connect to a host and provide operation commands to the host for operation of various information processing devices.
[0128] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application. Clearly, those skilled in the art can make various alterations and variations to this application without departing from its spirit and scope. Thus, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. Methods for handling operation commands for multiple device versions, including: Obtain the operation command, and retrieve the device version and command name from the operation command; Search the command set by command name to obtain the command index; Use the command index and device version to query the command version set to obtain the command version index; Use the command index and command version index to query the set of command implementation functions and obtain the command implementation functions; The obtained command implementation function is invoked to process the operation command; The command set includes multiple entries, and each entry records the command name of the operation command supported by various device versions; When querying a set of commands by command name, the index of the entry that records the command name in the set is used as the command index corresponding to the command name. The command version set includes multiple entries, and each entry in the command version set records a set of command version indexes. The elements of the command version index set record the command version index corresponding to the device version; When querying the command version set using the command index and device version, the command index is used as the index of the command version set to retrieve the first entry, and the element corresponding to the device version is retrieved from the command version index set of the first entry as the command version index; The command implementation function set includes multiple entries, and each entry in the command implementation function set records the command implementation function index set. The elements of the command implementation function index set record the command implementation function index, and the elements in the command implementation function index set are indexed by the command version index; When querying the command implementation function set using the command index and command version index, the command index is used as the index of the command implementation function set to retrieve the second entry. The element corresponding to the command version index is retrieved from the command implementation function index set of the second entry as the command implementation function index. The command implementation function index represents the command implementation function that can be called.
2. The method according to claim 1, wherein The device version obtained from the operation command will be mapped to a numerical value; Use the mapped value as an index to retrieve the corresponding element from the command version index set of the first entry record.
3. The method according to claim 1, wherein One or more elements in a single command version index set are identical, such that one or more device versions corresponding to the single command version index set have the same command implementation function.
4. The method according to claim 1, wherein If one or more elements in the single command version index set are different, the command implementation functions corresponding to one or more device versions among the multiple device versions corresponding to the single command version index set will be different.
5. The method according to claim 1, wherein One or more elements in the command version index set are empty or specified values to indicate that the corresponding command implementation function does not exist; In response to querying the command version set using the command index and device version, if the obtained command version index is null or a specified value, it indicates that the operation command cannot be processed.
6. The method according to claim 1, wherein The number of elements in the command implementation function index set is less than or equal to the number of the various device versions.
7. The method according to any one of claims 1-6, wherein The operation command also includes one or more parameters; when the obtained command implementation function is called, the one or more parameters are provided to the command implementation function.
8. The method according to claim 1, further comprising: In response to the addition of a first operation command that can be processed, if the first operation command is a new operation command, add the command name of the first operation command to the command set, and obtain the index of the first operation command in the command set as the first command index; Add a third entry to the command implementation function set, which is indexed by the first command index. In the third entry, record the command implementation function index of the first operation command, and obtain the index of the command implementation function index of the first operation command in the third entry. Add a fourth entry to the command version set, indexed by the first command index. In the fourth entry, add an element whose value is the command implementation function index of the first operation command, which is indexed by the device version that supports the first operation command, and whose value is the index of the third entry.
9. The method according to claim 8, further comprising: If the first operation command is an existing operation command, obtain the index of the first operation command in the command set as the index of the second command; If the command implementation function of the first operation command is a new command implementation function, retrieve the fourth entry from the command implementation function set using the second command index, add the index of the new command implementation function to the command implementation function index set recorded in the fourth entry, and obtain the index of the new command implementation function in the command implementation function index set recorded in the fourth entry; retrieve the fifth entry from the command version set using the second command index, and record the index of the new command implementation function in the command implementation function index set recorded in the fourth entry in the element corresponding to the device version of the first operation command in the command version index set of the fifth entry.
10. The method of claim 8, further comprising: If the command implementation function of the first operation command is an existing command implementation function and is applicable to the new device version, the fourth entry is obtained from the command implementation function set using the second command index, and the index of the existing command implementation function in the command implementation function index set recorded in the fourth entry is obtained from the command implementation function index set recorded in the fourth entry; the fifth entry is obtained from the command version set using the second command index, and an element corresponding to the new device version of the first operation command is added to the command version index set of the fifth entry, and the index of the existing command implementation function in the command implementation function index set recorded in the fourth entry is recorded in this element.
11. A method for managing operation commands, comprising: In response to the addition of a processable first operation command, if the first operation command is a new operation command, the command name of the first operation command is added to the command set, and the index of the first operation command in the command set is obtained as the first command index; a third entry is added to the command implementation function set, indexed by the first command index, and the command implementation function index of the first operation command is recorded in the third entry, and the index of the command implementation function index of the first operation command in the third entry is obtained; a fourth entry is added to the command version set, indexed by the first command index, and an element is added to the fourth entry whose value is the device version index supporting the first operation command and is the index of the command implementation function index of the first operation command in the third entry; The command set includes multiple entries, and each entry records the command name of the operation command supported by various device versions; When querying a set of commands by command name, the index of the entry that records the command name in the set is used as the command index corresponding to the command name. The command version set includes multiple entries, and each entry in the command version set records a set of command version indexes. The elements of the command version index set record the command version index corresponding to the device version; When querying the command version set using the command index and device version, the command index is used as the index of the command version set to retrieve the first entry, and the element corresponding to the device version is retrieved from the command version index set of the first entry as the command version index; The command implementation function set includes multiple entries, and each entry in the command implementation function set records the command implementation function index set. The elements of the command implementation function index set record the command implementation function index, and the elements in the command implementation function index set are indexed by the command version index; When querying the command implementation function set using the command index and command version index, the command index is used as the index of the command implementation function set to retrieve the second entry. The element corresponding to the command version index is retrieved from the command implementation function index set of the second entry as the command implementation function index. The command implementation function index represents the command implementation function that can be called.
12. The method of claim 11, further comprising: If the first operation command is an existing operation command, obtain the index of the first operation command in the command set as the index of the second command; If the command implementation function of the first operation command is a new command implementation function, retrieve the fourth entry from the command implementation function set using the second command index, add the index of the new command implementation function to the command implementation function index set recorded in the fourth entry, and obtain the index of the new command implementation function in the command implementation function index set recorded in the fourth entry; retrieve the fifth entry from the command version set using the second command index, and record the index of the new command implementation function in the command implementation function index set recorded in the fourth entry in the element corresponding to the device version of the first operation command in the command version index set of the fifth entry.
13. The method of claim 12, further comprising: If the command implementation function of the first operation command is an existing command implementation function and is applicable to the new device version, the fourth entry is obtained from the command implementation function set using the second command index, and the index of the existing command implementation function in the command implementation function index set recorded in the fourth entry is obtained from the command implementation function index set recorded in the fourth entry; the fifth entry is obtained from the command version set using the second command index, and an element corresponding to the new device version of the first operation command is added to the command version index set of the fifth entry, and the index of the existing command implementation function in the command implementation function index set recorded in the fourth entry is recorded in this element.
14. An information processing device, comprising a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method of any one of claims 1 to 13.