CN114968357A - Method and device for generating operation command for multiple storage device versions - Google Patents

Method and device for generating operation command for multiple storage device versions Download PDF

Info

Publication number
CN114968357A
CN114968357A CN202210334464.0A CN202210334464A CN114968357A CN 114968357 A CN114968357 A CN 114968357A CN 202210334464 A CN202210334464 A CN 202210334464A CN 114968357 A CN114968357 A CN 114968357A
Authority
CN
China
Prior art keywords
command
index
version
entry
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210334464.0A
Other languages
Chinese (zh)
Inventor
丁剑
董力维
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Memblaze Technology Co Ltd
Original Assignee
Beijing Memblaze Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Memblaze Technology Co Ltd filed Critical Beijing Memblaze Technology Co Ltd
Priority to CN202210334464.0A priority Critical patent/CN114968357A/en
Publication of CN114968357A publication Critical patent/CN114968357A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3004Arrangements for executing specific machine instructions to perform operations on memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30181Instruction operation extension or modification

Abstract

Methods and devices are provided for generating operating commands for multiple storage device versions. The method for processing the operation commands of the multiple device versions comprises the following steps: acquiring an operation command, and acquiring a device version and a command name from the operation command; inquiring the command set by using the command name to obtain a command index; inquiring a command version set by using the command index and the equipment version to obtain a command version index; inquiring a command realization function set by using the command index and the command version index to obtain a command realization function; and calling the obtained command implementation function to process the operation command.

Description

Method and device for generating operation command for multiple storage device versions
Technical Field
The present application relates to computer technology, and in particular, to a method of generating an operation command for multiple versions of an information processing apparatus.
Background
FIG. 1A illustrates a block diagram of a solid-state storage device. The solid state storage device 102 is coupled to a host for providing storage capability to the host. The host and the solid-state storage device 102 may be coupled by various methods, including but not limited to, connecting the host and the solid-state storage device 102 by, for example, 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, PCIE, high-speed Peripheral Component Interconnect), NVMe (NVM Express, high-speed nonvolatile storage), ethernet, fiber channel, wireless communication network, etc. The host may be an information processing device, such as a personal computer, tablet, server, portable computer, network switch, router, cellular telephone, personal digital assistant, etc., capable of communicating with the storage device in the manner described above. The Memory device 102 includes an interface 103, a control section 104, one or more NVM chips 105, and a DRAM (Dynamic Random Access Memory) 110.
NAND flash Memory, phase change Memory, FeRAM (Ferroelectric RAM), MRAM (magnetoresistive Memory), RRAM (Resistive Random Access Memory), XPoint Memory, and the like are common NVM.
The interface 103 may be adapted to exchange data with a host by means such as SATA, IDE, USB, PCIE, NVMe, SAS, ethernet, fibre channel, etc.
The control unit 104 is used to control data transfer between the interface 103, the NVM chip 105, and the DRAM 110, and also used for memory management, host logical address to flash physical address mapping, erase leveling, bad block management, and the like. The control component 104 can be implemented in various manners of software, hardware, firmware, or a combination thereof, for example, the control component 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 component 104 may also include a processor or controller in which software is executed to manipulate the hardware of the control component 104 to process IO (Input/Output) commands. The control component 104 may also be coupled to the DRAM 110 and may access data of the DRAM 110. FTL tables and/or cached IO command data may be stored in the DRAM.
Control section 104 includes a flash interface controller (otherwise known as a media interface, a media interface controller, a flash channel controller) that is coupled to NVM chip 105 and issues commands to NVM chip 105 in a manner that conforms to the interface protocol of NVM chip 105 to operate NVM chip 105 and receive command execution results output from NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI", etc.
The storage device stores main firmware and boot firmware. Control component 104 loads and executes firmware to process IO commands and to implement other functions of the storage device. The firmware is software run by a processor, such as storage device 104. The boot firmware is stored in, for example, a NOR flash memory (not shown) of the storage device 102. The control unit loads and executes the boot firmware from a designated address of the NOR flash memory after power-on. 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 in, for example, the NVM chip. To improve reliability, multiple images or copies of the main firmware are stored in the NVM chip. In response to the main firmware being loaded, the boot firmware hands over control to the main firmware.
The memory device includes a plurality of NVM chips. Each NVM chip includes one or more DIEs (DIE) or Logical Units (LUNs). The dies or logic units can respond to read and write operations in parallel. Multiple read, write, or erase operations are performed sequentially on the same die or logic.
FIG. 1B illustrates a schematic diagram of a host coupled to a storage device.
The host computer runs the storage management tool software. For the NVMe storage device, the storage management tool is NVMe-cli tool software available from the internet (https:// github. com/linux-NVMe/NVMe-cli), for example, for issuing NVMe commands to the storage device according to operation commands specified by a user and obtaining execution results of the commands. In addition to NVMe commands, the storage device supports other commands not defined in the NVMe protocol. For purposes of clarity, commands provided to the storage device by the storage management tool are referred to as storage commands, while commands provided to the storage device by a user are referred to as operation commands. The storage device receives and processes the storage command and provides the execution result to the host, and the storage management tool obtains the execution result of the storage command and presents the execution result to a user, for example.
The storage devices have multiple versions, and V1, V2, and V3 shown in fig. 1B represent different versions of the storage device, e.g., a storage device developed at different times, different storage devices supporting different versions of the NVMe protocol. The storage commands supported by different versions of storage devices may be slightly different, and thus, the storage management tool needs to provide a corresponding manner of generating and receiving storage commands for each storage device version.
FIG. 1C illustrates a schematic diagram of a storage management tool maintaining a plurality of storage commands for a plurality of storage device versions.
The storage management tool includes a library of command implementation functions. The library of command implementation functions includes a plurality of command implementation functions (denoted as Func1, Func2, … … Func 6). The storage management tool generates a storage command CMD1 for storage device V1 by calling the command implementation function Func 1. The command implementation function Func1 is also used to receive the processing result of the storage command CMD1 of the storage device V1.
In the example of FIG. 1C, storage device V1 and storage device V2 both support storage command CMD1 (storage device V1 has the same command name ("CMD 1")) as storage command CMD1 supported by storage device V2), whereas storage command CMD1 of storage device V1 and storage device V2 each have different forms, parameters, meanings and/or processes, and thus, in the command-implemented function library, storage command CMD1 of storage device V1 and storage command CMD1 of storage device V2 are generated by different functions Func1 and Func2, respectively. Similarly, in the command implementation function library, still different functions Func3 are provided to generate the storage command CMD1 for storage device V3.
Still in the example of FIG. 1C, storage device V1 also supports storage commands CMD2 and CMD3, but neither command is supported in storage devices V2 and V3, and thus there are no functions in the command implementation function library corresponding to the two commands. The function Func6 of the command implementation function library is used to generate a storage command CMD4 for the storage device V2.
FIG. 1D shows a flowchart of the storage management tool generating a management command according to an operation command input by a user.
A user enters an operation command, e.g., mgr [ version ] [ cmd-name ] [ paras ], to the storage management tool through, e.g., a console of the host operating system, 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 essential.
The storage management tool obtains the storage device version [ version ] and the operation command name [ cmd-name ] from the input operation hit. And searching a corresponding command realization function in a command realization function library according to the version [ version ] of the storage device and the name [ cmd-name ] of the operation command, and calling the found command realization function to process the operation command. Optionally, [ para ] is also provided to the command implementation function.
Disclosure of Invention
With the increase of storage device versions, the library of command implementation functions of the storage management tool is also increasingly large. Referring also to FIG. 1C, the same storage command may be processed in the same or different storage device versions, and the types of storage commands supported by different storage devices may be the same or different. The manner in which storage commands are processed by the same storage device may be updated. These have resulted in storage management tools becoming increasingly complex. And the modifications that need to be made when adding new operation commands and/or storage commands are increasingly complex. As complexity increases, maintenance of storage management tools becomes increasingly difficult. Therefore, it is desirable that the storage management tool can effectively maintain the processing mode of multiple storage commands in multiple storage device versions, and reduce the complexity of maintaining the storage management tool itself.
According to a first aspect of the present application, there is provided a first method for processing operation commands of multiple device versions according to the first aspect of the present application, including: acquiring an operation command, and acquiring a device version and a command name from the operation command; inquiring the command set by using the command name to obtain a command index; inquiring a command version set by using the command index and the equipment version to obtain a command version index; inquiring a command realization function set by using the command index and the command version index to obtain a command realization function; and calling the obtained command implementation function to process the operation command.
According to a first method for processing operation commands of multiple device versions according to a first aspect of the present application, a second method for processing operation commands of multiple device versions according to the first aspect of the present application is provided, wherein the command set includes multiple entries, and the entries of the command set record command names of operation commands supported by the multiple device versions; when the command set is queried by the command name, the index of the entry in the command set in which the command name is recorded is used as the command index corresponding to the command name.
According to the first or second method for processing operation commands of multiple device versions in the first aspect of the present application, there is provided a third method for processing operation commands of multiple device versions in the first aspect of the present application, wherein the command version set includes multiple entries, and the entries of the command version set record a command version index set; the element of the command version index set records a command version index corresponding to the equipment version; when the command version set is inquired by using the command index and the device version, a first entry is obtained by using the command index as an index of the command version set, and an element corresponding to the device version is obtained from the command version index set recorded by the first entry as a command version index.
According to a third method of processing multiple device versions of operation commands according to the first aspect of the present application, there is provided a fourth method of processing multiple device versions of operation commands according to the first aspect of the present application, wherein a device version obtained from an operation command is mapped to a numerical value; the mapped value is used as an index to obtain the corresponding element from the command version index set of the first entry record.
According to the third or fourth method for processing multiple device versions of operation commands of the first aspect of the present application, there is provided the fifth method for processing multiple device versions of operation commands of the first aspect of the present application, wherein one or more elements in a single command version index set are the same, so that command implementation functions corresponding to one or more device versions in multiple device versions corresponding to the single command version index set are the same.
According to one of the third to fifth methods for processing multiple device versions of operation commands of the first aspect of the present application, there is provided the sixth method for processing multiple device versions of operation commands of the first aspect of the present application, wherein one or more elements in a single command version index set are different, so that command implementation functions corresponding to one or more device versions in multiple device versions corresponding to the single command version index set are different.
According to one of the third to fifth methods of processing multiple device versions of an operation command of the first aspect of the present application, there is provided the seventh method of processing multiple device versions of an operation command of the first aspect of the present application, wherein one or more elements in the command version index set are null values or specified values to indicate that there is no corresponding command implementation function; and responding to the command version set queried by the command index and the equipment version, wherein the obtained command version index is the null value or the specified value and indicates that the operation command cannot be processed.
According to one of the first to seventh methods for processing operation commands of multiple device versions in the first aspect of the present application, there is provided the eighth method for processing operation commands of multiple device versions in the first aspect of the present application, wherein the command realization function set includes multiple entries, and the entry of the command realization function set records the command realization function index set; the elements in the command realization function index set record command realization function indexes, and the elements in the command realization function index set are indexed by a command version index; when the command index and the command version index are used for inquiring the command to realize the function set, the command index is used as the index of the command realization function set to obtain a second entry, an element corresponding to the command version index is obtained from the command realization function index set recorded by the second entry to be used as the command realization function index, and the command realization function index represents a command realization function which can be called.
According to a ninth aspect of the present application, there is provided a method for processing multiple device versions of operation commands, wherein the number of elements of the command realization function index set is less than or equal to the number of the multiple device versions.
According to one of the first to ninth methods of processing operation commands of multiple device versions according to the first aspect of the present application, there is provided the tenth method of processing operation commands of multiple device versions according to the first aspect of the present application, wherein the operation commands further include one or more parameters; providing the one or more parameters to the command implementation function upon invocation of the obtained command implementation function.
According to one of the methods of processing operation commands of a plurality of device versions according to the first to tenth aspects of the present application, there is provided the method of processing operation commands of a plurality of device versions according to the eleventh aspect of the present application, further comprising: responding to a first operation command which can be processed in an adding mode, if the first operation command is a new operation command, adding a command name of the first operation command to a command set, and acquiring an 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 in the command realization function set, recording a command realization function index of the command realization function of the first operation command in the third entry, and acquiring an index of the command realization function index of the first operation command in the third entry; and adding a fourth entry indexed by the first command index in the command version set, and adding an element of the index of the command implementation function indexed by the device version supporting the first operation command into the fourth entry, wherein the value of the index is the index of the command implementation function of the first operation command in the third entry.
According to a eleventh method of processing multiple device versions of operation commands according to the first aspect of the present application, there is provided the twelfth method of processing multiple device versions of operation commands according to the first aspect of the present application, further comprising: if the first operation command is an existing operation command, acquiring an index of the first operation command in the command set as a second command index; if the command realization function of the first operation command is a new command realization function, acquiring a fourth entry in the command realization function set by using the second command index, adding the index of the new command realization function in the command realization function index set recorded in the fourth entry, and acquiring the index of the new command realization function in the command realization function index set recorded in the fourth entry; and acquiring a fifth entry in the command version set by using the second command index, and recording an index of the new command realization function in the command realization function index set recorded in the fourth entry in an element corresponding to the device version of the first operation command in the command version index set of the fifth entry.
According to a twelfth method of processing operation commands of multiple device versions according to the first aspect of the present application, there is provided the thirteenth method of processing operation commands of multiple device versions according to the first aspect of the present application, further comprising: if the command realization function of the first operation command is the existing command realization function and is suitable for the new equipment version, acquiring a fourth entry in the command realization function set by using the second command index, and acquiring an index of the existing command realization function in the command realization function index set recorded by the fourth entry; and acquiring a fifth entry in the command version set by 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 realization function in the command realization function index set recorded in the fourth entry in the element.
According to a second aspect of the present application, there is provided a method of managing an operation command according to the second aspect of the present application, comprising: responding to a first operation command which can be processed in an adding mode, if the first operation command is a new operation command, adding a command name of the first operation command to a command set, and acquiring an 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 in the command realization function set, recording a command realization function index of the command realization function of the first operation command in the third entry, and acquiring an index of the command realization function index of the first operation command in the third entry; and adding a fourth entry indexed by the first command index in the command version set, and adding an element of the index of the command implementation function indexed by the device version supporting the first operation command into the fourth entry, wherein the value of the index is the index of the command implementation function of the first operation command in the third entry.
According to a second aspect of the present application, there is provided a method for managing an operation command according to the second aspect of the present application, further comprising: if the first operation command is an existing operation command, acquiring an index of the first operation command in the command set as a second command index; if the command realization function of the first operation command is a new command realization function, acquiring a fourth order in the command realization function set by using the second command index, adding an index of the new command realization function in the command realization function index set recorded in the fourth order, and acquiring an index of the new command realization function in the command realization function index set recorded in the fourth order; and acquiring a fifth entry in the command version set by using the second command index, and recording an index of the new command realization function in the command realization function index set recorded in the fourth entry in an element corresponding to the device version of the first operation command in the command version index set of the fifth entry.
According to a second method of managing an operation command of the second aspect of the present application, there is provided a third method of managing an operation command of the second aspect of the present application, further comprising: if the command realization function of the first operation command is the existing command realization function and is suitable for the new equipment version, acquiring a fourth entry in the command realization function set by using the second command index, and acquiring an index of the existing command realization function in the command realization function index set recorded by the fourth entry; and acquiring a fifth entry in the command version set by 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 realization function in the command realization function index set recorded in the fourth entry in the element.
According to a third aspect of the present application, there is provided an information processing apparatus comprising a memory, a processor and a program stored on the memory and executable on the processor, wherein the processor implements the method according to one of the first and second aspects of the present application when executing the program.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1A illustrates a block diagram of a solid-state storage device;
FIG. 1B illustrates a schematic diagram of a host coupled to a storage device;
FIG. 1C illustrates a schematic diagram of a storage management tool maintaining a plurality of storage commands for a plurality of storage device versions;
FIG. 1D illustrates a flow diagram for a storage management tool generating management commands based on user-entered operational commands;
FIG. 2A illustrates a schematic diagram of a command set of a storage management tool according to an embodiment of the application;
FIG. 2B illustrates a schematic diagram of a set of command-implemented functions of a storage management tool according to an embodiment of the present application;
FIG. 2C illustrates a schematic diagram of a set of command versions for a storage management tool according to an embodiment of the present application;
FIG. 3 illustrates a flow diagram for processing an operation command by a storage management tool according to an embodiment of the present application;
FIG. 4A illustrates a flow diagram for adding supported new operation commands for a storage management tool according to an embodiment of the present application;
FIGS. 4B, 4C, and 4D respectively show a command set, a command implementation function set, and a command version set corresponding to FIG. 4A;
FIG. 5A illustrates a flow diagram of existing operation command change command implementation functions supported by the storage management tool according to an embodiment of the application;
FIGS. 5B, 5C, and 5D respectively show a command set, a command implementation function set, and a command version set corresponding to FIG. 5A;
FIG. 6A illustrates a flow diagram of a new operation command to add supported new storage device versions for a storage management tool according to an embodiment of the present application;
FIGS. 6B, 6C, and 6D respectively show a command set, a command implementation function set, and a command version set corresponding to FIG. 6A;
FIG. 7A illustrates a flow diagram for adding existing operation commands supported for a new storage device version to a storage management tool according to an embodiment of the present application;
FIGS. 7B, 7C, and 7D show the command set, command implementation function set, and command version set, respectively, corresponding to FIG. 7A;
FIG. 8A illustrates a flow diagram for adding supported existing operation commands for a new storage device version and changing their change command implementation functions for a storage management tool according to an embodiment of the present application; and
fig. 8B, 8C and 8D show a command set, a command implementation function set and a command version set corresponding to fig. 8A, respectively.
Detailed Description
The technical solutions in the embodiments of the present application are clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
FIG. 2A illustrates a schematic diagram of a command set of a storage management tool according to an embodiment of the present application.
A command set is a data structure used by a storage management tool. The command set is provided by, for example, an array, a linear table, a linked list, a hash table, etc. The command set records a plurality of entries, each entry indicating an associated index and command name. For each name of an operation command supported by the storage management tool, there is a record in the command set. For the case where the same command name has different meanings in different storage device versions, only a single command name is recorded in the command set. Thus, each command name appears and only appears once (occupies an entry) in the command set.
In the example of FIG. 2A, the command set records 6 command names (get-a, set-a, get-b, set-b, identity, reset). The command name recorded in the corresponding entry can be obtained by using the index of the command set entry. In an operation command such as mgr [ version ] [ cmd-name ] [ param ], the [ cmd-name ] indicates a command name such as "get-a", "reset", and the like.
Optionally, the entry of the command set further records description information corresponding to the command name, and the description information records, for example, the function and the use mode of the command.
According to an embodiment of the application, when the storage management tool is required to add support to a new operation command, an entry is added to the command set to record the name of the new operation command. If the existing operation commands supported by the storage management tool are changed without changing the command names, no entries need to be added to the command set, and even no entries need to be changed from the existing command set.
FIG. 2B is a diagram illustrating a set of command-implemented functions of a storage management tool according to an embodiment of the present application.
The set of command realization functions is a data structure used by the storage management tool. The set of command implementation functions records a plurality of entries, each entry indicating an associated index and a set of command implementation function indices. Thus, the elements of the set of command realization functions remain sets.
For each command implementation function maintained by the storage management tool, there is a record in the set of command implementation functions. The index (e.g. pointer or reference) of the command implementation function is recorded in the command implementation function set, so that the storage management tool can call the corresponding command implementation function to process the operation command through the index of the command implementation function.
The index of the set of command realization functions is called the command index. The command index is associated with the index of the command set shown in FIG. 2A. For example, in the command set (see fig. 2A), the index of the command with the command name "get-b" is "2", and then "2" is used as the command index, and 2 command implementation function indexes (Func2-1 and Func2-2) corresponding to "get-b" are recorded in the entry obtained in the command implementation function set. Therefore, for the command name of the operation command input by the user, the index recording the entry corresponding to the command name is found from the command set as the command index, the command index is used for accessing the command realization function set to acquire the entry of the command realization function set, and the command realization function corresponding to the operation command is inevitably recorded in the entry acquired from the command realization function set.
Referring to fig. 2B, in the case where there are a plurality of command implementing functions for the command name, each of the plurality of command implementing functions is recorded in an entry of the command implementing function set indicated by the command index corresponding to the command name.
The number of command implementation function indices may be different in each entry of the set of command implementation functions. For example, referring to fig. 2B, for command index 0, 3 command realization function indexes are recorded in the corresponding entries; for command index 1, 1 command realization function index is recorded in the corresponding entry; for command index 4, its corresponding entry is an empty set, meaning that there is no corresponding command to implement the function. The storage management tool can identify the entry of the command realization function set as an empty set, and further prompt the user that the corresponding command name is not supported.
The entry of the set of command implementation functions is a set of command implementation function indices. The command realization function index set records 0, 1 or more command realization function indexes respectively corresponding to a plurality of storage device versions providing the command. So as to obtain the corresponding element (the command realization function suitable for the specific command name of the storage device version) from the command realization function index set according to the storage device version, and the operation command indicated by the command name is processed by calling the corresponding command realization function.
FIG. 2C is a diagram illustrating a set of command versions for a storage management tool according to an embodiment of the present application.
A set of command versions is a data structure used by the storage management tool. The command version set records a plurality of entries, each entry indicating an associated index and a set of command version indices. Thus, the elements of the command version set remain sets.
For each storage device version maintained by the storage management tool, there is a record in the set of command versions. The command version index set records values corresponding to each storage device version.
The index of the set of command versions is referred to as the command index. The command index is associated with the index of the command set shown in FIG. 2A. For example, in the command set (see fig. 2A), the index of the command with the command name "get-b" is "2", and then "2" is used as the command index, and the obtained entry in the command version set records the values corresponding to the storage device versions corresponding to "get-b". Referring to FIG. 2C, entries having a command index of "2" in the same command version set are [ V1-2], [ V2-2], [ V3-2], [ V4-2], where "[ V1-2 ]" represents that for command index "2", the value corresponding to storage device version V1 is [ V1-2 ]; and "[ V4-2 ]" represents that for the command index "2", the value corresponding to the storage device version V4 is [ V4-2 ]. The value [ V4-2] is used to index the set of command implementation function indices in FIG. 2B, which will be described in more detail below.
With continued reference to FIG. 2C, the element of the command version index set is of the form [ Vx-i ] which represents a numerical value as an index, e.g., 0, 1, 2 … … "[ Vx-i ]" Vx represents the storage device version Vx, and i represents the command index associated therewith. Thus, the entries indexed i in the command version set are the command version index set { [ V1-i ], [ V2-i ], [ V3-i ], [ V4-i ] }, and the 4 elements in the set are the values corresponding to storage version V1, storage version V2, storage version V3, and storage version V4, respectively.
In one example, the command version index set is an array, the index of the array is defined by the storage device versions supported by the storage management tool, and when the storage management tool supports M storage device versions, the number of elements of the array representing the command version index set is M. For example, for a command index i, the element indexed by the storage device version Vx in the command version index set is a value corresponding to the storage device version Vx; if a certain storage device version does not support the command represented by the command index i, in the entry of the command version set supported by the index i, the element corresponding to the storage device version is, for example, Null.
In yet another example, the command version index set is a linked list whose nodes record the storage device version Vx and the corresponding value [ Vx-i ]. For a command name with a command index of i, if the storage device version Vx supports the command name, < Vx, [ Vx-i ] > appears in an entry with an index of i in the command version set; if the storage device version Vx does not support the command name, < Vx, [ Vx-i ] > does not appear in the entry indexed i of the command version set.
In yet another example, the set of command version indices is a lookup table, the storage device version Vx is an index of an entry of the lookup table, and the value [ Vx-i ] corresponding to the storage device version Vx is a value of the lookup table entry.
Therefore, for the command name of the operation command input by the user, the index recording the entry corresponding to the command name is found from the command set to be used as the command index, the command index is used for accessing the command version set to obtain the entry of the command version set, the storage device version indicated in the operation command is used for finding the corresponding value from the entry, and the value is used as the index of the entry corresponding to the command index in the command realization function set to obtain the corresponding command realization function.
By providing a set of command versions, operating commands with the same command name can find different command implementation functions in different storage device versions, so that operating commands with the same command name can have different implementations or functions in different storage device versions.
According to the embodiment of the application, if the storage management tool needs to add support for a new storage device version, a value indexed by the new storage device version is added in one or more elements of the command version set, and the value is used as an index for the command implementation function index set. When the storage management tool needs to support a new storage device version, in addition to providing a command implementation function applicable to the new storage device version corresponding to each command name, adding a command implementation function index for adding a new storage device version to each command name in each entry of a command implementation function set, and adding a command version index for adding a new storage device version to each command name in a command version index set of each entry of the command version set, wherein the value of the command version index is used for indexing the command implementation function index added in the command implementation function index set.
FIG. 3 illustrates a flow diagram for processing an operation command by a storage management tool according to an embodiment of the present application.
A user operates the storage management tool on the host computer and inputs an operation command to the storage management tool. The operation command has a form such as mgr [ version ] [ cmd-name ] [ param ], where "[ version ]" indicates a storage device version and "[ cmd-name ]" indicates a command name of the operation command. It will be appreciated that the operation command may have other forms. As a specific example, the operation command is mgrV2 get-b.
The storage management tool extracts the storage device version and the 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 queries the command set with the obtained command name to obtain a command index corresponding to the command name. For example, for the command name "get-b", see also FIG. 2A, in the command set, the command name has a command index of "2".
With continued reference to FIG. 3, the command version set is queried with the retrieved command index (e.g., "2") and storage device version (e.g., "V2"). Referring also to FIG. 2C, by way of example, a command version index set "[ V1-2], [ V2-2], [ V3-2], [ V4-2 ]" is obtained from the command version set with a command index "2", and a corresponding element "[ V2-2 ]" is obtained from the command version index set "[ V1-2], [ V2-2], [ V3-2], [ V4-2" with a storage device version "V2" as the command version index. By way of example, the element "[ V2-2 ]" is an integer having a value of 1 (referred to as a command version index, which is an index to the command implementation function index set).
With continued reference to FIG. 3, the set of command implementation functions is queried with the obtained command index (e.g., "2") and command version index (element "[ V2-2 ]", value 1). Referring also to fig. 2B, as an example, the operation command "mgrV 2 get-B" is processed by obtaining a command realization function index set "Func 2-1, Func 2-2" from the command realization function set with a command index "2", and obtaining an element "Func 2-2" with an index of "[ V2-2 ]" (value of 1) as a command realization function index from the command realization function set "Func 2-1, Func 2-2" with a command version index ("[ V2-2 ]", value of 1), and calling the corresponding command realization function with the command realization function index "Func 2-2".
Optionally, the operation command also has a parameter "[ para ]". The storage management tool provides the parameter "[ para ]" to the command implementation function corresponding to the command implementation function index "func 2-2" without any additional processing of the parameter.
Alternatively, the command version index obtained from the command version set may be a Null value (Null) or a specified value, which means that the storage device version indicated by the operation command does not support the command name indicated by the current operation command for the current operation command provided by the user, so that the storage management tool terminates the processing of the operation command and prompts the user for an error, for example.
According to the embodiment of the application, the operation commands of a plurality of storage device versions can correspond to the same command implementation function, so that the elements corresponding to the storage device versions in the command version index set corresponding to a command index have the same value, and the same index in the function index set is implemented by the index command.
FIG. 4A illustrates a flow diagram for adding supported new operation commands for a storage management tool according to an embodiment of the present application.
Fig. 4B, 4C and 4D respectively show a command set, a command implementation function set and a command version set corresponding to fig. 4A.
When a new command (with the command name "new _ CMD") is added to a storage device of version V, the storage management tool needs to support the processing of the new command. The implementation function index of the new command is denoted as "Func _ new _ CMD".
For this purpose, whether the command name of the new command exists in the command set is searched in the command set, the command name does not exist in the command set because "new _ CMD" is the new command, then an entry is added in the command set to record the command name "new _ CMD", and an index of the newly added entry is obtained as a command index. Referring to fig. 4B, the latest entry is recorded at the last position of the command set, the Index (command Index) of which is "New _ Index", and the value of the entry is the command name "New _ CMD".
Referring back to fig. 4A, next, a New entry is added to the command implementation function set to record the command implementation function Index "Func _ New _ CMD" of the New command, and the Index of the New entry is made to be the command Index ("New _ Index") obtained by adding an entry to the command set before. Referring to fig. 4C, the latest entry is recorded at the last position of the command implementation set, and its Index (command Index) is "New _ Index", and the value of the entry is the command implementation function Index "Func _ New _ CMD". It will be appreciated that the value of the entry of the set of command implementation functions is the set, and the command implementation function index "Func _ new _ CMD" is an element of the set. According to the embodiment of the present application, even if the command implementation function of the new command "new _ CMD" is the same as the command implementation function already managed by the storage management tool, when a new command is added, a new entry is added to the set of command implementation functions, and the index of the command implementation function is recorded in the new entry without using the existing entry in which the index of the command implementation function is recorded.
Continuing with FIG. 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 the New entry is the command Index ("New _ Index") resulting from the previous addition of an entry to the command set. Since the command name "New _ CMD" represents a New command, the New command is currently supported only in the storage device version V, so that in the command version Index set of the entry with the command version set Index "New _ Index", there is only a single element representing the command implementation function Index of the operation command with the command name "New _ Index" of the storage device version V, the Index in the element (command implementation function Index set) of the command implementation function set. Referring to fig. 4D, the latest entry is recorded at the rearmost position of the command realization set, and its Index (command Index) is "New _ Index", and the value "[ V-New _ Index ]" (e.g., equal to 0) of the entry indicates that the element Func _ New _ CMD whose Index is the value "[ V-New _ Index ]" of the command realization function Index set in the entry whose Index is "New _ Index" of fig. 4C is the corresponding command realization function Index.
It will be appreciated that the entry (command implementation function index set) of the command version set is 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 may be indexed by the storage device version V. "V" before "-" of "[ V-New _ index ]" in FIG. 4D 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, and since these storage device versions do not support the new command yet, the elements corresponding to other storage device versions are set to a specified value (e.g., "(E)") in the command implementation function index set, and by identifying the specified value, the storage management tool knows that these storage device versions do not support the new command yet.
FIG. 5A illustrates a flow diagram of existing operation command change command implementation functions supported by the storage management tool according to an embodiment of the application.
Fig. 5B, 5C and 5D show a command set, a command implementation function set and a command version set corresponding to fig. 5A, respectively.
Simply, when the command implementation function of the operation command is updated, the command implementation function itself can be modified without changing the command set, the command implementation function set, and the command version set. Alternatively, for the case where a new command implementation function is provided, it may be implemented by changing only the command implementation function index in the set of command implementation functions. However, in some cases, the same command implementation function is used for operation commands of different storage device versions, or the same command implementation function is used for different operation commands, and the update to the command operation function only applies to part but not all of the storage device versions or to part but not all of the operation commands. In these cases, it is not possible to change the command implementation function for an existing operation command supported by the storage management tool by changing only the command implementation function index in the command implementation function set.
Referring to FIG. 5A, a new command implementation function (e.g., func _ b) is provided for the operation command of the storage device of version V1 (with the command name "set-b"), which the storage management tool needs to add to the management of.
For this purpose, the command set is looked up for whether the command name of the operating command is present in the command set. Since "set-B" is an existing command, the command name is found in the command set, and its index (3) in the command set is obtained as the command index (see also fig. 5B, the command name of the entry whose index is 3 is "set-B").
Next, the corresponding entry is fetched in the command implementation function set with the previously fetched command index (3), whose old value is the set "Func 3" (see fig. 5C, whose index is the entry of 3). The command implementation function index "func _ b" of the new command implementation function (func _ b) is added to the set of command implementation function indices represented by the entry. When the command realization function index "Func _ b" is added to the set of command realization function indexes represented by the entry, it is also known that the index of the command realization function index "Func _ b" in the set is 1 (the index of the element "Func 3" is 0).
Next, the corresponding entry is obtained in the command version set with the previously obtained command index (3), the old values of which are the sets "[ V1-3], [ V2-3], [ V3-3], [ V4-3 ]". In the command version index set represented by the entry, an element ([ V1-3]) of the corresponding storage device version V1 is updated, and the element is updated to the index (1) of the command realization function index "func _ b" in the command realization function index set (see fig. 5D, which is an entry whose index is 3).
By this, the update of the storage management tool is completed. When the operation command "mgrV 1 set-b" is input to the storage management tool again, the storage management tool calls the newly added command implementation function func _ b by the command implementation function index "func _ b".
FIG. 6A illustrates a flow diagram of a new operation command to add supported new storage device versions for a storage management tool according to an embodiment of the present application.
Fig. 6B, 6C and 6D show a command set, a command implementation function set and a command version set corresponding to fig. 6A, respectively.
When the storage management tool needs to support a new command (with the command name "new _ CMD") of a new storage device version Vw, the storage management tool needs to support the processing of the new command. The implementation function index of the new command is denoted as "Func _ new _ CMD".
For this purpose, whether the command name of the new command exists in the command set is searched in the command set, the command name does not exist in the command set because "new _ CMD" is the new command, then an entry is added in the command set to record the command name "new _ CMD", and an index of the newly added entry is obtained as a command index. Referring to fig. 6B, the latest entry is recorded at the last position of the command set, and its Index (command Index) is "New _ Index".
Next, a New entry is added to the command implementation function set to record the command implementation function Index "Func _ New _ CMD" of the New command, and the Index of the New entry is made to be the command Index ("New _ Index") obtained by adding an entry to the command set before (see fig. 6C). It will be appreciated that the value of an entry of 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 the element in the set is obtained (e.g., 0 or a determinable specified value).
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 the New entry is made the command Index ("New _ Index") resulting from the previous addition of an entry to the command set. In the command version Index set of the entry of the command version set indexed to "New _ Index", an element ([ Vw-New _ Index ]) (see fig. 6D) is added, which represents an Index of the command implementation function Index "Func _ New _ CMD" in the entry of the command implementation function set indexed to "New _ Index" (command implementation function Index set), and which 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 the Index "New _ Index" of the command version set, and since these other storage device versions do not support the operation command corresponding to the command name "New _ CMD", these elements corresponding to other storage device versions are set to, for example, a Null value (Null) or a specified value (E) (not shown in fig. 6D).
Optionally, if the operation command is added for the storage device version Vw for the first time, elements corresponding to the storage device version Vw are also added in other entries (entries whose Index is not "New _ Index") in the command version Index set, where the elements are indexed by the storage device version Vw in the command version Index set, and the values of the elements are, for example, Null values (Null) to indicate that the storage device version Vw does not support the operation command corresponding to the entry where the element is located yet.
FIG. 7A illustrates a flow diagram for adding existing operation commands supported for a new storage device version to a storage management tool according to an embodiment of the present application.
Fig. 7B, 7C and 7D show a command set, a command implementation function set and a command version set corresponding to fig. 7A, respectively.
For the existing command, the existing command realization function is utilized to process the command without adding a new command realization function in the command realization function library, so that the inconsistency caused by code redundancy and subsequent updating is avoided.
Referring to FIG. 7A, adding support in the storage management tool for an existing operation command ("reset") whose command implementation function is also existing (e.g., "Func 5") for the storage device version Vw (its command name is "reset").
For this purpose, the command set is looked up for whether the command name of the operating command is present in the command set. Since "reset" is an existing command, the command name is found in the command set, and its index (5) in the command set is obtained as the command index (see also fig. 7B, the command name of the entry whose index is 5 is "reset").
Next, a corresponding entry is obtained in the command realization function set with the previously obtained command index (5), whose value is the set "Func 5" (see fig. 7C, whose index is the entry of 5). The index of the command implementation function ("Func 5") of the operation command ("reset") to be added and the index of the command implementation function in the command implementation function index set are looked up in the command implementation function index set represented by the entry. In the example of FIG. 7C, "Func 5" is the only element of the index set of the command implementation function in which it resides, and thus its index is, for example, a value of 0 or a determinable specified value.
Next, the corresponding entry, the value of which is the set "[ V1-5], [ V2-5], [ V3-5], [ V4-5 ]" is obtained with the previously obtained command index (5) in the command version set. In the command version index set represented by this entry, the element of the corresponding storage device version Vw ([ Vw-5]) is added and its value is set to the index of "Func 5" in the command implementation function index set (e.g., 0 value or a determinable specified value, shown as 0 value [ Vw-5] ═ 0 in the example of fig. 7D).
By this, the update of the storage management tool is completed. When the operation command "mgrvwrest" is input to the storage management tool, the storage management tool will process the operation command "reset" for the storage device version Vw by commanding the implementation function index "Func 5".
FIG. 8A illustrates a flow diagram for adding supported existing operation commands for a new storage device version and changing their change command implementation functions for a storage management tool according to an embodiment of the application.
Fig. 8B, 8C and 8D show a command set, a command implementation function set and a command version set corresponding to fig. 8A, respectively.
In some cases, the new storage device version supports the existing operation command, but the operation command is processed in a different manner from the previous operation command, and a new command implementation function needs to be added to the command implementation function library, so that the existing operation command submitted to the new storage device version is processed by the new command implementation function.
Referring to FIG. 8A, adding support in the storage management tool for an existing operation command ("reset") whose command implementation function is new (e.g., "Func _ new") for the storage device version Vw.
For this purpose, the command set is looked up for whether the command name of the operating command is present in the command set. Since "reset" is an existing command, the command name is found in the command set, and its index (5) in the command set is obtained as the command index (see also fig. 8B, the command name of the entry whose index is 5 is "reset").
Next, a corresponding entry is fetched in the command realization function set with the previously fetched command index (5), whose value is the set "Func 5". The command implementation function index "Func _ new" of the new command implementation function (Func _ new) is added to the set of command implementation function indexes represented by the entry (see fig. 8C). When the command realization function index "Func _ new" is added to the set of command realization function indexes represented by the entry, it is also known that the index of the command realization function index "Func _ new" in the set is 1 (the index of the element "Func 5" is 0).
Next, the corresponding entry is obtained in the command version set with the previously obtained command index (5), the old values of which are the sets "[ V1-5], [ V2-5], [ V3-5], [ V4-5 ]". In the command version index set represented by this entry, the element of the corresponding storage device version Vw ([ Vw-5]) is added, and its value is set to "Func _ new" as the index in the command implementation function index set (e.g., 1, shown as [ Vw-5] ═ 1 in the example of fig. 8D).
By this, the update of the storage management tool is completed. When the operation command "mgrvwrest" is input to the storage management tool, the storage management tool will process the operation command "reset" for the storage device version Vw by commanding the implementation function index "Func _ new".
Optionally, if the operation command is added for the storage device version Vw for the first time, elements corresponding to the storage device version Vw are also added in other entries (entries with index not being 5) in the command version index set, where the elements are indexed by the storage device version Vw in the command version index set, and the values are, for example, Null values (Null) to indicate that the storage device version Vw does not support the operation command corresponding to the entry where the element is located yet.
It should be understood that the storage management tool has described the processing of various operation commands for the storage device and the processing manner of the command implementation function through various examples, however, the technical solution of the present application is not limited to the storage device, but may be applied to various information processing devices that are connected to the host and provide the host with operation commands to operate.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application. It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method of processing multiple device versions of operating commands, comprising:
acquiring an operation command, and acquiring a device version and a command name from the operation command;
inquiring the command set by using the command name to obtain a command index;
inquiring a command version set by using the command index and the equipment version to obtain a command version index;
inquiring a command realization function set by using the command index and the command version index to obtain a command realization function;
and calling the obtained command implementation function to process the operation command.
2. The method of claim 1, wherein
The command set comprises a plurality of entries, and the entries of the command set record command names of operation commands supported by a plurality of device versions;
when the command set is queried by the command name, the index of the entry in the command set in which the command name is recorded is used as the command index corresponding to the command name.
3. The method of claim 1 or 2, wherein
The command version set comprises a plurality of entries, and the entries of the command version set record a command version index set;
the element of the command version index set records a command version index corresponding to the equipment version; when the command version set is inquired by using the command index and the device version, a first entry is obtained by using the command index as an index of the command version set, and an element corresponding to the device version is obtained from the command version index set recorded by the first entry as a command version index.
4. The method of claim 3, wherein
Mapping the device version obtained from the operation command into a numerical value;
the mapped value is used as an index to obtain the corresponding element from the command version index set of the first entry record.
5. The method of claim 3 or 4, wherein
One or more elements in the single command version index set are the same, so that the command implementation functions corresponding to one or more device versions in the multiple device versions corresponding to the single command version index set are the same.
6. Method according to one of claims 3 to 5, wherein
One or more elements in the single command version index set are different, so that the command implementation functions corresponding to one or more device versions in the multiple device versions corresponding to the single command version index set are different.
7. Method according to one of claims 3 to 6, wherein
One or more elements in the command version index set are null values or specified values to indicate that there is no corresponding command implementation function;
and responding to the command version set queried by the command index and the equipment version, wherein the obtained command version index is the null value or the specified value and indicates that the operation command cannot be processed.
8. The method according to one of claims 1 to 7, wherein
The command realization function set comprises a plurality of entries, and the entries of the command realization function set record a command realization function index set;
the elements of the command realization function index set record command realization function indexes, and the elements in the command realization function index set are indexed by command version indexes;
when the command index and the command version index are used for inquiring the command to realize the function set, the command index is used as the index of the command realization function set to obtain a second entry, an element corresponding to the command version index is obtained from the command realization function index set recorded by the second entry to be used as the command realization function index, and the command realization function index represents a command realization function which can be called.
9. The method according to one of claims 1-8, further comprising:
responding to a first operation command which can be processed in an adding mode, if the first operation command is a new operation command, adding a command name of the first operation command to a command set, and acquiring an 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 in the command realization function set, recording a command realization function index of the command realization function of the first operation command in the third entry, and acquiring an index of the command realization function index of the first operation command in the third entry;
and adding a fourth entry indexed by the first command index in the command version set, and adding an element of the index of the command implementation function indexed by the device version supporting the first operation command into the fourth entry, wherein the value of the index is the index of the command implementation function of the first operation command in the third entry.
10. An information processing apparatus comprising a memory, a processor and a program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 9 when executing the program.
CN202210334464.0A 2022-03-31 2022-03-31 Method and device for generating operation command for multiple storage device versions Pending CN114968357A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210334464.0A CN114968357A (en) 2022-03-31 2022-03-31 Method and device for generating operation command for multiple storage device versions

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210334464.0A CN114968357A (en) 2022-03-31 2022-03-31 Method and device for generating operation command for multiple storage device versions

Publications (1)

Publication Number Publication Date
CN114968357A true CN114968357A (en) 2022-08-30

Family

ID=82975621

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210334464.0A Pending CN114968357A (en) 2022-03-31 2022-03-31 Method and device for generating operation command for multiple storage device versions

Country Status (1)

Country Link
CN (1) CN114968357A (en)

Similar Documents

Publication Publication Date Title
US9164887B2 (en) Power-failure recovery device and method for flash memory
US9292434B2 (en) Method and apparatus for restoring flash translation layer (FTL) in non-volatile storage device
US11580162B2 (en) Key value append
US10891074B2 (en) Key-value storage device supporting snapshot function and operating method thereof
KR20140042522A (en) Apparatus and method for directory entry look up, and recording medium recording the directory entry look up program thereof
JP7058132B2 (en) Systems and methods for maximized deduplication memory
US11556466B2 (en) Logical-to-physical data structures
US10691601B2 (en) Cache coherence management method and node controller
EP4174677A1 (en) Data reading and writing method and device
CN109976669B (en) Edge storage method, device and storage medium
US11354192B2 (en) Data storage devices and methods for firmware failure prevention
US9338057B2 (en) Techniques for searching data associated with devices in a heterogeneous data center
CN108628760B (en) Method and device for atomic write command
US20200409915A1 (en) Database key compression
CN114020193A (en) Cross-page checking determination method and device, electronic equipment and storage medium
CN108628761B (en) Atomic command execution method and device
KR101565975B1 (en) User device including flash memory storing index and index accessing method thereof
CN110334034B (en) Mapping table dynamic loading method and device, computer equipment and storage medium
WO2023235040A1 (en) File system improvements for zoned storage device operations
CN114968357A (en) Method and device for generating operation command for multiple storage device versions
US10552376B1 (en) Accessing files stored in a firmware volume from a pre-boot application
CN111625477B (en) Processing method and device for read request for accessing erase block
CN111104435B (en) Metadata organization method, device and equipment and computer readable storage medium
US20160232166A1 (en) Method and Apparatus for Accessing File
CN113849482A (en) Data migration method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination