Method for using extended functions of storage device through file system

Accessing functions outside the logical address space of the storage device through file system solves the problems of high usage threshold and work complexity caused by the increase in commands, and achieves seamless enhancement and simplification of functions.

CN119105690APending Publication Date: 2024-12-10BEIJING STARBLAZE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310684537.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-09
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

In the prior art, with the increase of custom commands, management commands and extended commands, users need to learn new command meanings, formats and operating methods, resulting in a high threshold for use, and the work complexity of modifying NVMe-CLI software and storage devices increases. .

Method used

Accessing functions outside the logical address space of the storage device through file system means that users only need to operate files in the file system. The host and the storage device interact with custom commands to carry path information to achieve access or operation of specified data. Reduces user learning costs and work complexity.

Benefits of technology

It simplifies the complexity of users operating storage devices, reduces the need for modification of NVMe-CLI software and storage devices, achieves seamless enhancement and use of new functions, and lowers the threshold for use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119105690A_ABST
    Figure CN119105690A_ABST
Patent Text Reader

Abstract

The invention provides a method for using an extended function of a storage device through a file system, the storage device provides a logic address space serving as a block device for a host, the storage device comprises one or more specified data and / or specified operations which can be accessed by the host, and the logic address space does not comprise one or more specified data and / or specified operations; the method comprises the following steps: in response to a first file accessing a file system through the file system of a host, generating a first self-defined command conforming to a storage protocol command format according to a first path corresponding to the first file, and sending the first self-defined command to a storage device; receiving a first response fed back by the storage device, generating a second response for accessing the first file according to the first response, and outputting the second response through a file system of the host; wherein the first response corresponds to one of one or more specified data and / or specified operations associated with the first file. The application can reduce the use threshold of the user and simplify the work complexity of accessing the storage device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method for extending functions of a storage device using a file system. Background Art

[0002] Figure 1 The block diagram of the storage device is shown. The storage device 102 is coupled to the host to provide storage capacity for the host. The host and the storage device 102 can be coupled in a variety of ways, including but not limited to connecting the host and the solid-state storage device 102 through a variety of storage protocols such as 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), NVMe (NVM Express), Ethernet, Fiber Channel, wireless communication network, etc. The host can be an information processing device that can communicate with the storage device in the above manner, such as a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 102 includes an interface 103 , a control component 104 , one or more NVM chips 105 , and a 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] The interface 103 may be adapted to exchange data with the host via, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fibre Channel, etc.

[0005] The control component 104 is used to control data transmission between the interface 103, the NVM chip 105 and the DRAM 110, and is also used for storage management, mapping of host logical addresses to flash physical addresses, erase leveling, bad block management, etc. The control component 104 can be implemented in a variety of ways, such as 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 can also include a processor or a 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 can also be coupled to the DRAM 110 and can access the data of the DRAM 110. The data of the FTL table and / or cached IO commands can be stored in the DRAM.

[0006] The control component 104 includes a flash memory interface controller (or medium interface controller, flash memory channel controller), which is coupled to the NVM chip 105 and issues commands to the NVM chip 105 in a manner that complies with the interface protocol of the NVM chip 105 to operate the NVM chip 105, and receives command execution results output from the NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI" and the like.

[0007] In the storage device 102, the FTL (Flash Translation Layer) is used to maintain the mapping information from the logical address to the physical address. The logical address constitutes the storage space of the storage device perceived by the upper-layer software such as the operating system. The physical address is the address used to access the physical storage unit of the storage device. In the related art, the address mapping can also be implemented using the intermediate address form. For example, the logical address is mapped to the intermediate address, and then the intermediate address is further mapped to the physical address. The FTL table is an important metadata in the storage device. Usually, the data items of the FTL table record the address mapping relationship in the storage device in units of data pages.

[0008] The logical address space is the storage address space provided by the storage device to the host. The host uses the elements (logical addresses) in the logical address space to access the storage device. Generally speaking, the logical address (Logical Block Addressing, LBA) space accessible to the host is the same size as the LBA space provided by the storage device. For the logical address space, the storage device manages the mapping between the logical address and the physical address through the FTL table. The host sends a read / write command that meets the NVMe protocol (hereinafter referred to as NVMe command) to the storage device. The NVMe command indicates the logical address (LBA address) to be accessed. The storage device converts the LBA address into a physical address (PBA) based on the FTL table managed in the control unit, and then the control unit accesses the NVM chip according to the PBA address. For example, see Figure 2 and Figure 3 shown.

[0009] The storage device not only provides the function of reading and writing the logical address space, but also provides other functions beyond the logical address space. For example, accessing the specified data of the storage device (such as the CPU operating frequency, storage medium wear, etc.) or operating the storage device to perform specified operations (such as setting a password for the storage space, enabling the storage device to assist in the test or debugging process, etc.). In order to enable the host to use the functions other than the read and write logical address space provided by the storage device, the NVMe protocol allows the storage device to support custom commands (Vendor Specific Command) (the data content carried by the custom command is not defined in the NVMe protocol, but meets the format requirements of the NVMe protocol for the command), and the host uses custom commands to access the storage device. The host uses the functions provided by the storage device beyond the access logical address space through custom commands. In addition, in addition to custom commands, the NVMe protocol also defines commands that provide other functions in addition to basic IO commands (such as read / write commands), such as management commands (Admin Command) or other forms of extended commands. Summary of the invention

[0010] In order to facilitate the user to operate the host to issue custom commands, management commands and / or extended commands to the storage device to use other functions provided by the storage device other than the access logical address space. The host provides a software tool such as NVMe-CLI. The user operates the NVMe-CLI software through the command line to operate the host to issue these commands to the storage device. In order to operate the NVMe-CLI software to control the host to issue these commands to the storage device, the user needs to learn the meaning, format and operation method of these commands.

[0011] However, in order to meet the actual needs of users as much as possible, storage devices support adding new custom commands according to the actual needs of users or support frequent changes in custom commands, and with the evolution and development of the NVMe protocol, the types and forms of management commands and extended commands are also constantly increasing or changing. Due to situations such as those listed above, the types of custom commands, management commands and / or extended commands are constantly increasing / changing. As the number of commands continues to increase, users need to learn the meaning, format and operation methods of the new or changed commands to be used, resulting in a high threshold for command use, and often causing storage devices to work abnormally due to misunderstandings and misuses of users. On the other hand, as the number of commands continues to increase, the NVMe-CLI software and storage devices need to be modified accordingly to support the new or changed commands. Due to the large number of command types, the complexity of modifying the NVMe-CLI software and modifying the storage device has increased dramatically.

[0012] In view of the problems in the prior art that the command usage threshold is high and the complexity of modifying software and storage devices is greatly increased as the number of commands increases, this application hopes to use other functions provided by the storage device beyond accessing the logical address space without increasing the usage threshold and work complexity.

[0013] In a first aspect, an embodiment of the present application provides a method for accessing a storage device, which is applied to a host, wherein the storage device provides a logical address space as a block device to the host, and the storage device also includes one or more specified data and / or specified operations accessible by the host; the logical address space does not include the one or more specified data and / or specified operations; the method includes:

[0014] In response to accessing a first file of the file system through the file system of the host, generating a first custom command conforming to a storage protocol command format according to a first path corresponding to the first file, and sending the first custom command to the storage device;

[0015] receiving a first response fed back by the storage device in response to the first custom command, generating a second response for accessing the first file according to the first response, and outputting the second response through the file system of the host;

[0016] The first response corresponds to one of the one or more specified data and / or specified operations associated with the first file.

[0017] Optionally, generating a first custom command conforming to a storage protocol command format according to the first path corresponding to the first file comprises one of the following steps:

[0018] Determine a first file index according to the first path, and generate the first custom command carrying the first file index;

[0019] According to the first path, the first custom command carrying the first path is generated.

[0020] Optionally, the host includes a first metadata set, and the first metadata set records a mapping relationship between a file path and the one or more specified data and / or specified operations;

[0021] The determining the first file index according to the first path includes:

[0022] Determine a first file index corresponding to the first path from the first metadata set, where the first file index is used to index one of the one or more specified data and / or specified operations corresponding to the first file; or

[0023] The first file index is generated by calculation according to the first path.

[0024] Optionally, the mapping relationship includes a first sub-mapping relationship between the file path and the file index;

[0025] The determining, from the first metadata set, a first file index corresponding to the first path includes:

[0026] Based on the first sub-mapping relationship recorded in the first metadata set, a first file index corresponding to the first path is determined.

[0027] Optionally, the mapping relationship includes a second sub-mapping relationship among a file index, a file attribute, and an address; and the method further includes:

[0028] Determining an operation type of accessing the first file through the file system of the host;

[0029] Searching for a first file attribute corresponding to the first file index based on the second sub-mapping relationship, and detecting whether the first file attribute matches the operation type;

[0030] In the case where the first file attribute matches the operation type, the step of generating a first custom command conforming to the storage protocol command format and sending the first custom command to the storage device is performed.

[0031] Optionally, the method further comprises:

[0032] If the first file attribute does not match the operation type, a corresponding response is output through the host's file system without executing the step of generating a first custom command that conforms to the storage protocol command format and sending the first custom command to the storage device.

[0033] Optionally, the first response indicates whether the first file attribute matches the operation type.

[0034] Optionally, before generating a first custom command conforming to a storage protocol command format according to the first path corresponding to the first file, the method further includes:

[0035] Receive request information for mounting a file system;

[0036] In response to the request information, generate a second custom command that complies with the storage protocol command format, and send the second custom command to the storage device;

[0037] Receive a first metadata set fed back by the storage device in response to the second custom command, and mount a file system constructed from the first metadata set on the file system of the host; wherein the first metadata set includes at least part of the content in the second metadata set obtained by the storage device based on the second custom command.

[0038] Optionally, the method further comprises:

[0039] In response to accessing the file-associated content in the file system of the host, obtaining the file-associated content according to the first metadata set, and outputting the file-associated content through the file system of the host; and / or

[0040] In response to changing the file-associated content in the file system of the host, error information is output through the file system of the host.

[0041] Optionally, the method further comprises:

[0042] In response to a first access request to access the logical address space of the storage device in a block device manner through the host, determine the corresponding logical address and access type according to the first access request, generate a storage protocol command and send it to the storage device;

[0043] A third response fed back by the storage device to the storage protocol command is received.

[0044] Optionally, the method further comprises:

[0045] In response to accessing a second file of the file system through the file system of the host, generating a fourth custom command conforming to a storage protocol command format according to a second path corresponding to the second file, and sending the fourth custom command to the storage device, wherein the second file is stored in a logical address space of the storage device;

[0046] A fourth response fed back by the storage device to the fourth custom command is received, a fifth response for accessing the second file is generated according to the fourth response, and the fifth response is output through the file system of the host.

[0047] Optionally, the method further comprises:

[0048] In response to accessing a third file of the file system through the file system of the host, generating a first IO command that complies with a storage protocol command format, and sending the first IO command to the storage device;

[0049] receiving a sixth response fed back by the storage device in response to the first IO command;

[0050] The third file is stored in the logical address space of the storage device.

[0051] Optionally, after the host sends the first custom command carrying the first path information corresponding to the first path of the file system of the host to the storage device, the storage device obtains a first index based on the first path information, accesses one of the one or more specified data based on the first index and / or performs one of the one or more specified operations based on the first index to obtain a corresponding result, and generates the first response based on the corresponding result and provides it to the host.

[0052] In a second aspect, an embodiment of the present application further provides a host, comprising: a memory for storing instructions executed by at least one processor; and a processor for executing the instructions stored in the memory to perform the steps of the method for accessing a storage device described in the first aspect above.

[0053] In a third aspect, an embodiment of the present application provides a storage device response method, which is applied to a storage device, wherein the storage device provides a logical address space as a block device to a host, and the storage device also includes one or more specified data and / or specified operations accessible by the host; the logical address space does not include the one or more specified data and / or specified operations; the method includes:

[0054] receiving a first custom command sent by the host, where the first custom command complies with a storage protocol command format and carries first path information corresponding to a first path of a file system of the host;

[0055] In response to the first custom command, obtaining a first index corresponding to the first path information;

[0056] Access one of the one or more specified data according to the first index and / or perform one of the one or more specified operations according to the first index, and obtain a corresponding result;

[0057] A first response is generated according to the corresponding result and sent to the host.

[0058] Optionally, the storage device includes a second metadata set, and the second metadata set records a mapping relationship between the path information and the one or more specified data and / or specified operations.

[0059] Optionally, the path information is a file index or a file path of a file system;

[0060] In response to the first custom command, obtaining a first index corresponding to the first path information includes one of the following steps:

[0061] Extracting a first index corresponding to the first path information from the first custom command;

[0062] Extracting the first path information from the first custom command, and determining a first index corresponding to the first path information based on the second metadata set;

[0063] A first index is calculated and generated according to the first path information extracted from the first custom command.

[0064] Optionally, after receiving the first custom command, the method further includes:

[0065] After obtaining the first index corresponding to the first path information, searching for the first attribute corresponding to the first index based on the second metadata set;

[0066] Detecting whether the first attribute matches the operation type carried by the first custom command;

[0067] When the first attribute matches the operation type, one of the one or more specified data associated with the first index is accessed based on the first index, and / or one of the one or more specified operations associated with the first index is performed.

[0068] Optionally, the method further comprises:

[0069] When the first attribute does not match the operation type, an error message is carried in the first response.

[0070] Optionally, the first index is an address or a function pointer used to access one of the one or more specified data and / or perform one of the one or more specified operations.

[0071] Optionally, accessing one of the one or more specified data according to the first index and / or performing one of the one or more specified operations according to the first index comprises one of the following steps:

[0072] Reading designated data according to the address corresponding to the first index;

[0073] Write designated data to the address corresponding to the first index.

[0074] Optionally, accessing one of the one or more specified data according to the first index and / or performing one of the one or more specified operations according to the first index includes:

[0075] Run the program code at the address corresponding to the first index to perform one of the one or more specified operations; or

[0076] Calling the function pointer corresponding to the first index to execute a function that implements one of the one or more specified operations; or

[0077] Data is written to the address corresponding to the first index, and one of the one or more specified operations is executed based on the data control.

[0078] Optionally, in a case where the operation type corresponding to the first custom command is an execution operation, in response to the first custom command corresponding to the execution operation, running the program code stored at the address corresponding to the first index to execute one of the one or more specified operations;

[0079] In a case where the operation type corresponding to the first custom command is a write operation, in response to the first custom command corresponding to the write operation, a configuration parameter is written to the address corresponding to the first index, and one of the one or more specified operations is performed based on the configuration parameter.

[0080] Optionally, the one or more specified operations include at least one of password setting, debugging mode switching, and fault injection during testing.

[0081] Optionally, before receiving the first custom command sent by the host, the method further includes:

[0082] receiving a second custom command sent by the host, where the second custom command complies with a storage protocol command format;

[0083] In response to the second customized command, a first metadata set is provided to the host; wherein the first metadata set includes at least a portion of the data in the second metadata set.

[0084] Optionally, the method further comprises:

[0085] receiving a first IO command sent by the host, where the first IO command is a storage protocol command and indicates a logical address of the logical address space;

[0086] According to the first IO command, data is read from the logical address or data is written to the logical address, and a sixth response is generated and provided to the host according to the access result.

[0087] Optionally, the method further comprises:

[0088] receiving a fourth custom command sent by the host, where the fourth custom command is generated based on a second path corresponding to a second file and complies with a storage protocol command format, where the second file is a file accessed through a file system of the host and stored in the logical address space;

[0089] In response to the fourth custom command, a fourth response corresponding to the fourth custom command is fed back to the host, and the host generates a fifth response for accessing the second file according to the fourth response, and outputs the fifth response through the file system of the host.

[0090] In a fourth aspect, an embodiment of the present application further provides a storage device, comprising: a memory for storing instructions executed by at least one processor; and a processor for executing the instructions stored in the memory to execute the steps of the storage device response method described in the third aspect above.

[0091] In a fifth aspect, an embodiment of the present application further provides a storage system, comprising: the host described in the second aspect and the storage device described in the fourth aspect.

[0092] According to an embodiment of the present application, various other functions other than reading and writing the logical address space of the storage device, which used to need to be operated separately through custom commands, are provided to users in the form of a file system. Thus, users use the various other functions of the storage device in the way they are familiar with operating files. Even if the storage device adds new other functions, from the user's point of view, it only needs to operate the newly added files of the file system, so the user hardly needs to pay extra learning costs to use the new other functions. In order to realize the new other functions, there is no need to add new custom commands to the storage device, nor is there a need for the host to construct and send new custom commands to the storage device. Instead, the information required to express the new function is carried in a single or specified format custom command, which lowers the threshold for use. Even without modifying the host program and the storage device firmware, new functions can be added to the storage device by updating the configuration data, and the user can use the new functions, which simplifies the complexity of accessing the storage device. BRIEF DESCRIPTION OF THE DRAWINGS

[0093] Figure 1 A block diagram representing a storage device;

[0094] Figure 2 A schematic diagram showing host access to a storage device;

[0095] Figure 3 A schematic diagram showing the logical address space of a host accessing a storage device;

[0096] Figure 4 A schematic diagram showing a method for accessing a storage device provided in an embodiment of the present application;

[0097] Figure 5 A schematic diagram showing accessing a storage device through a host file system provided in an embodiment of the present application;

[0098] Fig. 6A A schematic diagram showing that a host sends a custom command carrying a hash value to a storage device, and the storage device obtains relevant information based on the custom command, provided by an embodiment of the present application;

[0099] Figure 6B A schematic diagram showing that a host according to an embodiment of the present application calculates a hash value according to a file path, sends a custom command carrying the hash value to a storage device, and the storage device obtains relevant information based on the custom command;

[0100] Figure 6C A schematic diagram showing that a host sends a custom command carrying a file path to a storage device, and the storage device obtains relevant information based on the custom command, provided by an embodiment of the present application;

[0101] Fig. 7AA schematic diagram showing the interaction between a user, a host, and a storage device during the mounting phase provided by an embodiment of the present application;

[0102] Figure 7B An example of generating a first metadata set based on a mapping relationship provided in an embodiment of the present application is shown;

[0103] Figure 8 A schematic diagram showing different ways for a host to access a storage device provided by an embodiment of the present application;

[0104] Fig. 9 A schematic diagram showing a storage device response method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0105] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0106] In the embodiment of the present application, the storage device not only provides the function of accessing the logical address space, but also provides other functions outside the logical address space (hereinafter referred to as accessing specified data or performing specified operations). The following mainly targets the use of custom commands between the host and the storage device to access specified data outside the logical address space or perform specified operations. In order to avoid the high threshold of use and the complexity of work caused by the increase of custom commands in the process of the host using custom commands to access the specified data provided by the storage device or operate the storage device to perform specified operations. According to the embodiment of the present application, a special file system is mounted on the host and the storage device, and the file system mounted on the host makes it possible to display to the user that the host accesses the specified data in the storage device or operates the storage device to perform specified operations in a file system manner, and according to the file system mounted on the host and the storage device, the host and the storage device interact through custom commands to access the specified data in the storage device or control the storage device to perform specified operations. According to the embodiment of the present application, the custom command conforms to the storage protocol definition (such as the NVMe protocol) in the command form or format, and the path information is indicated in the command content. There are many forms of path information. For example, path information includes but is not limited to the file path itself or a file index, where the file index is, for example, a hash value obtained by hash calculation based on the file path, or a memory address of a storage device associated with the file path, a physical address of a NAND flash memory, or a function pointer.

[0107] According to the file system provided in the embodiment of the present application, when the user operates the host to access the specified data in the storage device or operates the storage device to perform a specified operation, the user only needs to send an access file command to the host through the file system. After receiving the user's access file command, the host will convert the access file command into a custom command through the file system mounted on the host. The file system mounted on the storage device determines the address or pointer corresponding to the specified data associated with the file to be accessed or the specified operation to be performed according to the path information indicated by the custom command. The storage device accesses the specified data or performs the specified operation according to the address or pointer. Therefore, in the embodiment of the present application, from the user's point of view, operating the host to access the specified data in the storage device or operating the storage device to perform a specified operation is controlled by the file system. The user only needs to learn the content related to the file system access method (such as file path, reading / writing / executing files, providing parameters to file operations, etc.), and does not need to pay attention to the meaning, format and operation method of the custom command, thereby reducing the threshold for using custom commands. In addition, after receiving the user's command to access the file, the host converts the user's command to access the file into a custom command indicating the path information through the file system mounted thereon, that is, for accessing different specified data or performing different specified operations, the custom command type transmitted between the host and the storage device is single, and all carry path information. Therefore, the NVMe-CLI software and storage device only need to support the custom command provided by the embodiment of the present application, and there is no need to modify the NVMe-CLI software and storage device accordingly as the access requirements change, thereby reducing the complexity of the work. It is also possible to use the functions provided by the storage device through custom commands by using the file system instead of the NVMe-CLI tool.

[0108] It should be understood that the method provided in the embodiments of the present application for accessing specified data in a storage device or operating a storage device to perform specified operations in a file system manner through a file system is different from the file system access method in the prior art. In the embodiments of the present application, the specified data in a storage device or the storage device is accessed in a file system manner or the storage device is operated to perform specified operations, but the user only sees that various files are operated in a file system manner (the files represent the specified data or operations of the storage device), while the host and the storage device actually interact through custom commands.

[0109] It is understandable that the host usually supports multiple file systems that exist at the same time. For example, an NTFS or FAT file system partition is mounted on the EXT4 file path. The file system representing the specified data / operation of the storage device according to the embodiment of the present application can be mounted on other file systems by providing a standard file system interface. Thus, the user operates the existing file system and the file system of the embodiment of the present application by operating the user interface provided by the existing file system in the host. In different occasions, the file system, as a technical term, can represent an executable program that provides a standard file system interface and provides file system functions, and can also represent a file organization method embodied in a hierarchical directory structure. In combination with the context, those skilled in the art will clearly understand its meaning.

[0110] It should be noted that the embodiments of the present application can be understood as: mounting the file system provided by the embodiments of the present application on an existing file system, converting the user's operation of accessing other functions outside the logical address space in a file system manner into a custom command through the file system provided by the embodiments of the present application, and accessing other functions outside the logical address space through the custom command.

[0111] The following is an introduction to a method for accessing a storage device on the host side, wherein the storage device provides a logical address space as a block device to the host, and the storage device also includes one or more specified data and / or specified operations that can be accessed by the host; the logical address space does not include one or more specified data and / or specified operations; see Figure 4 As shown, the method includes:

[0112] Step 401: In response to accessing a first file of a file system through a file system of a host, a first custom command conforming to a storage protocol command format is generated according to a first path corresponding to the first file, and the first custom command is sent to a storage device.

[0113] The user accesses a first file of the file system through the file system of the host. For example, the first file is a file corresponding to the specified data / operation of the storage device presented to the user by the file system, and the file system of the host is, for example, a file system interface provided by an existing file system, a standard file system interface, or an executable program providing file system functions.

[0114] Based on user access, the host obtains the first path corresponding to the first file, generates a first custom command that complies with the storage protocol command format (NVMe protocol command format) based on the first path, and sends the generated first custom command to the storage device. The storage device accesses the specified data associated with the first file and / or performs the specified operation associated with the first file based on the first custom command to obtain the corresponding result.

[0115] In this embodiment, the host's file system is displayed to the user as operating the host to access specified data in the storage device or control the storage device to perform specified operations in a file system manner. The host generates a custom command based on the user's access to the file system, and uses the custom command to access one or more specified data included in the storage device and / or control the storage device to perform specified operations.

[0116] Step 402: Receive a first response from the storage device to the first custom command, generate a second response for accessing the first file based on the first response, and output the second response through the host's file system; wherein the first response corresponds to one or more specified data and / or one of specified operations associated with the first file.

[0117] After the storage device accesses the specified data and / or performs the specified operation based on the first custom command and obtains the corresponding result, it generates a first response to the first custom command and feeds the first response back to the host. After the host receives the first response fed back by the storage device, it generates a second response for the user to access the first file based on the first response, and outputs the second response through the file system of the host, so that the user obtains the access result of accessing the first file based on the second response.

[0118] The first response fed back by the storage device is the response data corresponding to the first custom command, and the first custom command corresponds to the first file that the user wants to access. The first file is associated with specified data and / or specified operations, and the first custom command corresponds to the specified data and / or specified operations associated with the first file. The storage device can access the specified data associated with the first file and / or perform the specified operation associated with the first file based on processing the first custom command, so that from the user's perspective, the host is controlled to access the specified data in the storage device or the storage device is controlled to perform a specified operation by accessing the file.

[0119] As an example, Figure 5 As shown, the host provides a file system to the user. In the file system, "root" is the root directory, and the root directory root includes multiple subdirectories, namely, the "home" directory, the "SSD_Root" directory, the "bin" directory, and the "etc" directory. The "SSD_Root" directory corresponds to the file system used to present the specified data / operation of the storage device to the user in the embodiment of the present application.

[0120] For example, the SSD Root directory includes three sub-directories: NAND, FTL, and CPU. The NAND / FTL / CPU directory may further include sub-directories and / or files at the next level. For example, a file in the NAND directory represents the number of times the NVM chip of the storage device has been erased and written. Still for example, Figure 5The CPU directory includes a CPU_frequency file, which represents the current clock frequency of the CPU of the storage device. Figure 5 It will be obvious that the file path of the "CPU_frequency" file is " / root / SSD_Root / CPU / CPU_frequency". According to an embodiment of the present application, the user obtains the data of the "CPU_frequency" file in a manner of operating the file in the host, such as using the "cat / root / SSD_Root / CPU / CPU_frequency" command, and the data represents the current clock frequency of the storage device.

[0121] The storage device provides the host with the current clock frequency of its CPU, which is one of the specified data provided by the storage device of the embodiment of the present application. The user obtains the specified data provided by the storage device by operating the "CPU_frequency" file without having to learn how to use the custom command.

[0122] Since the host provides the user with a file system, when the user accesses the NAND, FTL, and CPU directories in the storage device, the user generates, for example, a file access command "<command type, file path>" in the manner of operating the file system. The "command type" in the file access command is used to indicate the operation performed on the file or directory corresponding to the file path, including but not limited to ls, cat, echo>, exec, rename, rm, etc. Among them, ls means listing the files and directories under the specified directory, cat means getting data from the specified file, "echo>" means writing data to the specified file, exec means running the specified file, rename means modifying the specified file or directory name, and rm means deleting the specified file or directory.

[0123] For example, if the user wants to obtain the CPU operating frequency of the storage device, the user thinks that the "CPU_frequency" file is read. The file access command sent by the user to read the "CPU_frequency" file is "cat / root / SSD_Root / CPU / CPU_frequency", where " / root / SSD_Root / CPU / CPU_frequency" indicates the path of the file to be accessed in the file system; cat indicates the operation of reading the file.

[0124] The access file command "cat / root / SSD_Root / CPU / CPU_frequency" is provided by the user to the host. After receiving the access file command, the host recognizes that the "SSD_Root" directory is to be accessed based on " / root / SSD_Root" in the access file command. Since the "SSD_Root" directory is maintained by the file system of the embodiment of the present application, the host hands the access file command "cat / root / SSD_Root / CPU / CPU_frequency" to the file system of the embodiment of the present application for processing, rather than to other file systems in the host.

[0125] The file system of the embodiment of the present application determines that the command type is "read data" based on "cat" in the file access command, and accordingly marks the command type in the custom command to be generated, and marks the path information in the custom command to be generated based on the file path information "SSD_Root / CPU / CPU_frequency" of the file access hit. Thus, a custom command <command type, path information> corresponding to the file access command "cat / root / SSD_Root / CPU / CPU_frequency" can be generated, and the custom command can be sent to the storage device.

[0126] After receiving the custom command, the storage device parses the custom command to obtain the command type and path information. The storage device can know what operation to perform (for example, read data, write data, or execute a specified function) based on the parsed "command type". The storage device can obtain the address of the data to be accessed or the method of executing the specified function based on the parsed "path information". For example, for the "CPU_frequency" data, it can be obtained from the specified memory address "PCA" of the storage device. After reading the storage device CPU operating frequency, the storage device feeds it back to the host as the response data of the custom command. After receiving the response data, the host feeds back the storage device CPU operating frequency to the user as the response data of the access file command sent by the user.

[0127] As another example, the specified operation provided by the storage device is to set a password. The specified operation is presented as an executable file "Set_PWD" in the "SSD_Root" directory. The user controls the storage device to perform the operation of setting the password by executing the executable file "Set_PWD" in the file system and providing a parameter representing the password value. Accordingly, the "command type" obtained by the storage device from the custom command is execution, and the function pointer and the parameter representing the password value are obtained according to the "path information", the function represented by the function pointer is called or executed, and the parameter representing the password value is provided to the function, thereby completing the processing of the custom command. Optionally, the storage device also returns the return value after the function is executed to the host as a response to the custom command.

[0128] Since the custom command provided in the embodiment of the present application conforms to the command format of the standard storage protocol (such as the NVMe protocol), the host command processing unit of the storage device can easily identify the custom command and provide a response to the custom command to the host in the manner specified by the storage protocol. The host's storage device driver also sends the custom command to the storage device in the manner specified by the storage protocol and receives a corresponding response. Therefore, when the "command type" and "path information" carried in the custom command change, the host's storage device driver and the host command processing unit of the storage device do not need to be modified.

[0129] The custom command provided according to the embodiment of the present application indicates path information, wherein the path information includes but is not limited to a file path, a hash value, a pointer or an address. As an example, the path information is a hash value generated according to the file path, or a memory address of a storage device, a physical address of a NAND flash memory or a function pointer mapped according to the file path by a table lookup or the like. The file path is, for example, a file path or a relative path thereof carried in a file access command provided by a user.

[0130] Since the host displays the file system to the user, the file access command sent by the user when accessing a file in the file system needs to indicate the file path of the file to be accessed in the file system. As an example, if the custom command indicates a file index, after receiving the file access command sent by the user, the host determines the file index to be accessed based on the file path of the file to be accessed in the file system indicated by the file access command, and generates a custom command <command type, file index> based on the file index. As another example, if the custom command indicates a file path, the host can directly generate a custom command <command type, file path> according to the file path of the file to be accessed in the file system indicated by the file access command; wherein the command type of the custom command includes, for example, read, write, execute, etc.

[0131] In an optional embodiment, the host maintains a metadata set to provide a mapping from a file path to a memory address of a storage device, a physical address of a NAND flash memory, or a function pointer. The metadata set is, for example, a lookup table, in which entries of the lookup table record the "file path" or its hash value in association with the memory address of a storage device, the physical address of a NAND flash memory, or a function pointer. FIG. 6A to FIG. 6C As shown, it is an example of recording the relationship between a file path or a hash value and a memory address, a physical address of a NAND flash memory, and a function pointer.

[0132] Optionally, when the custom hit carries a "file path", the host does not need to maintain a metadata set to provide a mapping from the file path to the memory address of the storage device, which also simplifies the operations to be performed in the host to implement the embodiments of the present application. In this case, the storage device needs to calculate a hash value based on the "file path", as shown in Figure 6C However, the "file path" may be complex, and in particular, its string length may exceed the data length that can be carried by the custom command specified by the storage protocol.

[0133] Alternatively, when a custom command carries a "file index", its data length becomes controllable without conflicting with the requirements of the storage protocol. For example, a file path of any length is hashed using a specified hash algorithm to obtain a hash value of a specified length as the file index. Fig. 6A as well as Figure 6B As another example, a file index is a memory address of a storage device, a physical address of a NAND flash memory, or a function pointer. These types of data usually do not have a large size and can be carried by a custom command.

[0134] Still optionally, the metadata set also provides file attributes. File attributes are associated with the file path. File attributes indicate, for example, whether the file is readable or read-only, writable or write-only, executable, unreadable, unwritable, unexecutable, etc. Therefore, based on the file attributes, it can also be known whether the operation required by the command type required by the user is reasonable, such as whether it matches the file attributes. For example, for an executable file, the user may not be allowed to read it; or for a read-only file, the user may not be allowed to execute it. Based on the attribute information, according to an embodiment of the present application, it is possible to detect on the host side whether the user's command type matches the file attribute, and when there is a mismatch, an error is reported to the user without generating a custom command or sending a custom command to the storage device. Only when the command type matches the file attribute is a custom command generated and sent to the storage device.

[0135] In another embodiment, the file path described in the file access command provided by the user represents a directory rather than a file. The host can usually respond to the file access command based on the metadata set without generating a custom command to send to the storage device. For example, the file system access command is "ls / root / SSD_Root", which is intended to list all subdirectories and files in the "SSD_Root" directory. In response, the host obtains the three directories ("NAND" directory, "FTL" directory, and "CPU directory" included in the "SSD_Root" directory through the metadata set, but does not include any files, see also Figure 5 ), the names of the three directories and optional attribute information are displayed to the user as feedback on the file access. In this process, no custom commands are generated.

[0136] For example, Figure 4 The method of generating a first custom command that conforms to the storage protocol command format according to the first path corresponding to the first file includes one of the following steps:

[0137] Determine a first file index according to the first path, and generate a first custom command carrying the first file index;

[0138] According to the first path, a first custom command carrying the first path is generated.

[0139] When generating the first custom command, the first file index is determined according to the first path corresponding to the first file, and the first custom command is generated based on the first file index. In this implementation, the first custom command carries the first file index associated with the first path of the first file. It should be understood that the "first file index" here refers to the file index corresponding to the file path of the first file, which has the same meaning as the "file index" above.

[0140] When generating the first custom command, the first custom command may also be directly generated according to the first path corresponding to the first file. In this implementation, the first custom command carries the first path of the first file.

[0141] As an example, in order to enable the host to determine the file index to be accessed based on the file path of the file to be accessed indicated by the file access command in the file system, the file system mounted by the host includes a metadata set (hereinafter collectively referred to as the first metadata set) that records the mapping relationship between the file path and one or more specified data and / or specified operations, and the host determines the file index corresponding to the file path through the data recorded in the first metadata set. It should be understood that in the embodiment of the present application, when the user accesses the file through the file system to operate the host to access the specified data in the storage device or control the storage device to perform a specified operation, the file to be accessed by the user is associated with one or more specified data or specified operations; the file index corresponding to the file to be accessed by the user is used to index one of the one or more specified data and / or specified operations.

[0142] Below Figure 4 In the process of determining the first file index corresponding to the first path, in an optional implementation scheme, the host includes a first metadata set, and the first metadata set records the mapping relationship between the file path and one or more specified data and / or specified operations; when determining the first file index according to the first path, it may include:

[0143] Determine a first file index corresponding to the first path from the first metadata set, where the first file index is used to index one or more specified data and / or one of specified operations corresponding to the first file; or

[0144] A first file index is generated according to the first path calculation.

[0145] The file system mounted by the host includes a first metadata set, and the mapping relationship between the file path and one or more specified data and / or specified operations recorded in the first metadata set is a mapping relationship stored by the host through the file system.

[0146] As an example, the mapping relationship recorded in the first metadata set includes a mapping relationship between a file path and a file index. The host can determine the file index corresponding to the file path in the file system of the file to be accessed indicated by the access file command based on the mapping relationship between the file path and the file index recorded in the first metadata set. That is, when determining the first file index based on the first path, the first file index corresponding to the first path can be determined based on the first sub-mapping relationship (the mapping relationship between the file path and the file index) recorded in the first metadata set.

[0147] When determining the first file index according to the first path, after obtaining the first path corresponding to the first file, calculation may be performed directly based on the first path to generate the first file index by calculation.

[0148] According to an embodiment of the present application, when a user accesses a file in the file system of a host, the command type in the access file command indicates that a corresponding operation is to be performed on the file or directory corresponding to the file path. If the corresponding operation can be performed on the file or directory corresponding to the file path based on the command type indication, the file corresponding to the file path at this time must have the attribute indicated by the command type. However, in some scenarios, the file corresponding to the file path does not have the attribute indicated by the command type, that is, the command type in the access file command conflicts with the file attribute, and the access file command sent by the user cannot be processed normally at this time. When the command type in the access file command conflicts with the file attribute, the user's operation based on the access file command to operate the host to access the specified data of the storage device or control the storage device to perform a specified operation will fail, so the user's access behavior through the access file command will be an illegal operation.

[0149] As an example, the host checks whether the command type in the file access command conflicts with the file attribute, that is, verifies whether the user access behavior is legal. The process of verifying the user access behavior is introduced below.

[0150] In an optional implementation, the first metadata set also includes a mapping relationship between a file index, a file attribute, and an address (a second sub-mapping relationship). The host determines the operation type of the user accessing the file through the host's file system, where the operation type can be a read type, a write type, or an execute type; in addition, the operation type here has the same meaning as the command type in the command to access the file sent by the user above. Since the first metadata set of the host includes a mapping relationship between a file index, a file attribute, and an address, after the host determines the file index corresponding to the file path of the file to be accessed, it searches for the file attribute corresponding to the file index corresponding to the file to be accessed based on the mapping relationship, and the file attribute can be readable, writable, or executable, and detects whether the file attribute matches the operation type of accessing the file. For example, if the operation type of the file is a read type and the file attribute is readable, it indicates that the file attribute matches the operation type of the file. In the case where the file attribute matches the operation type of the file, it is determined that the user accessing the file through the host's file system is a legal operation. After determining that accessing the file through the host's file system is a legal operation, the host can generate a custom command based on the file to be accessed and send it to the storage device.

[0151] Accordingly, when the file attributes do not match the file operation type, the host can output a corresponding response through the host's file system without generating a custom command to send to the storage device, and the response includes a prompt content that the file attributes do not match the operation type.

[0152] In an optional implementation, it is possible to detect on the storage device side whether accessing a file through the host's file system is a legal operation. For example, after the host sends a first custom command to the storage device, it receives prompt information fed back by the storage device when it determines that a first file attribute corresponding to the first file matches an operation type corresponding to the first file; based on the prompt information, it is determined that accessing the first file through the host's file system is a legal operation.

[0153] After the host generates the first custom command and sends it to the storage device, the storage device detects whether the first file attribute corresponding to the first file matches the operation type corresponding to the first file. If the storage device determines that the first file attribute matches the operation type corresponding to the first file, it can execute the command. If it determines that the first file attribute does not match the operation type corresponding to the first file, it outputs an error message. The host determines that accessing the first file through the host's file system is an illegal operation based on the error message. That is, the purpose of the detection on the storage device side can be understood as: to determine whether to execute the command.

[0154] In this implementation, the storage device verifies whether accessing the file through the host's file system is a legal operation, and the file system mounted on the storage device includes a mapping relationship between the file index, the file attribute, and the address in the first metadata set, so as to determine the file attribute corresponding to the file based on the mapping relationship. In addition, the storage device may also include a mapping relationship between the file path and the file index in the first metadata set, and determine the file index corresponding to the file path based on the mapping relationship.

[0155] In the case where the storage device verifies whether accessing a file through the host's file system is a legal operation, when the storage device determines that the first file attribute matches the operation type corresponding to the first file, the storage device can execute a custom command and carry a prompt that the first file attribute matches the operation type in the first response; if it is determined that the first file attribute does not match the operation type corresponding to the first file, the first response that the first file attribute does not match the operation type can be directly returned. It should be noted that after the host verifies whether accessing a file through the host's file system is a legal operation and determines that the operation is a legal operation, a custom command can be sent to the storage device end. After obtaining the custom command, the storage device again verifies whether accessing a file through the host's file system is a legal operation, thereby achieving double verification on the host side and the storage device side.

[0156] According to the file system provided in the embodiment of the present application, when a user accesses the specified data of a storage device or controls the storage device to perform a specified operation through the file system of the host, the custom command exchanged between the host and the storage device indicates the path information. In order for the storage device to access the specified data or perform the specified operation based on the custom command, the storage device needs to determine the address to be accessed by the custom command, that is, it needs to obtain the address according to the path information indicated by the custom command. The address is, for example, the memory address of the storage device, the physical address of the NAND flash memory, or the function pointer of the specified function.

[0157] As an example, in order to enable the storage device to obtain the address according to the path information indicated by the custom command, a metadata set (hereinafter referred to as the second metadata set) is also included in the storage device; wherein the second metadata set records the mapping relationship between the path information and one or more specified data and / or specified operations, for example, the second metadata set includes a mapping relationship between a file index and an index. Thus, the index corresponding to the file index is queried from the metadata set according to the file index. For another example, the second metadata set includes a mapping relationship between a file path and an index, and the index corresponding to the file path is queried from the metadata set according to the file path. The meaning of "index" will be described below.

[0158] Optionally, the path information of the custom command is a file path. The storage device can generate a file index based on the file path calculation, and use the file index to query the metadata set to obtain the corresponding address. Optionally, the storage device can perform a hash calculation on the file path to obtain the file index. Still optionally, the hash calculation used in the storage device is the same as the hash calculation used in the host.

[0159] Still optionally, the path information of the custom command includes the memory address of the storage device, the physical address of the NAND flash memory, or the function pointer of the specified function, so that the storage device extracts the memory address of the storage device, the physical address of the NAND flash memory, or the function pointer of the specified function from the path information to access the specified data or perform the specified operation. The memory address of the storage device, the physical address of the NAND flash memory, or the function pointer of the specified function has various forms, and they are all used to access the specified data or perform the specified operation. The memory address of the storage device, the physical address of the NAND flash memory, or the function pointer of the specified function, and other data forms with similar functions for accessing the specified data or performing the specified operation are all referred to as indexes, or indexes for accessing the specified data or performing the specified operation.

[0160] In order to enable a user to access specified data of a storage device through a file system of a host or to control the storage device to perform a specified operation, the host and the storage device interact through a custom command. Before processing the user to access specified data of a storage device through a file system of the host or to control the storage device to perform a specified operation, the host needs to have a first metadata set and / or the storage device needs to have a second metadata set.

[0161] In an optional embodiment of the present application, before generating a first custom command conforming to the storage protocol command format according to the first path corresponding to the first file, a request message for mounting a file system is received; in response to the request message, a second custom command conforming to the storage protocol command format is generated, and the second custom command is sent to the storage device; a first metadata set fed back by the storage device for the second custom command is received, and the file system constructed from the first metadata set is mounted on the existing file system of the host. As an example, the file system constructed by the first metadata set is a file system that can access the specified data of the storage device or control the storage device to perform a specified operation provided in the embodiment of the present application; wherein the first metadata set includes at least part of the content in the second metadata set obtained by the storage device based on the second custom command. The request message is, for example, a command sent by a user to the host to mount the file system of the embodiment of the present application. After receiving the second custom command, the storage device generates a second metadata set based on the second custom command, determines a first metadata set based on at least part of the content in the second metadata set, feeds back the first metadata set to the host, and the host receives the first metadata set fed back by the storage device.

[0162] The first metadata set includes the directory structure of the file system representing the data and / or operation of the storage device in the embodiment of the present application, including directories, files and their hierarchical relationships at each level. Based on the directory structure in the first metadata set, the host's file system can display, for example, the "SSD_Root" directory and the subdirectories and files contained therein to the user (see also Figure 5 ). Thus, by browsing or traversing the "SSD_Root" directory, the user can know what data the storage device provides access to or what specified operations it provides in addition to the logical address space access.

[0163] The storage device is aware of the specified data and specified operations it provides. Therefore, the storage device generates a second metadata set based on the specified data and specified operations it provides. The storage device organizes the specified data and specified operations it provides in a hierarchical directory structure so that each data / operation has a unique path in the directory structure. The path corresponds one-to-one to the file path for accessing the corresponding data / operation in the host's file system, so that the storage device can obtain the file path of each data / operation in the host file system based on the path of each data / operation in the directory structure, and then obtain the hash value of the file path. The storage device also knows the address or function pointer at which each data / operation is accessed in the storage device, so that the storage device also generates an association relationship between the file path or the hash value of the file path and the address or function pointer at which the corresponding data / operation is accessed in the storage device, and the data representing this association relationship is also part of the second metadata set.

[0164] Optionally or further, the first metadata set also provides a mapping from a file path or a file index to specified data and / or a specified operation of a storage device. For example, the first metadata set includes a mapping from a file path to a memory address of a storage device, a physical address of a NAND flash memory, or a function pointer. As another example, the first metadata set includes a mapping from a file index to a memory address of a storage device, a physical address of a NAND flash memory, or a function pointer. As another example, the first metadata set includes a mapping from a file path to a file index.

[0165] As an example, the second metadata set records the mapping relationship between the file path and one or more specified data and / or specified operations. The first metadata set generated based on the second metadata set may include the second sub-mapping relationship (the mapping relationship between file index, file attribute, and address) and the first sub-mapping relationship (the mapping relationship between file path and file index), or may only include the first sub-mapping relationship.

[0166] As another example, when the first metadata set only includes the first sub-mapping relationship, the host cannot verify whether accessing the file through the host's file system is a legal operation; when the first metadata set includes the first sub-mapping relationship and the second sub-mapping relationship, the host can verify whether accessing the file through the host's file system is a legal operation.

[0167] According to an embodiment of the present application, the "SSD_Root" directory (see also Figure 5) is provided by the storage device. Before the storage device is connected to the host, the "SSD_Root" directory does not exist in the host-side file system. Therefore, the storage device needs to provide the host with a first metadata set so that the host can obtain the directory structure of the "SSD_Root" directory and implement the file system of the embodiment of the present application. The host requests the storage device to provide the first metadata set through a second custom command. And construct, for example, the "SSD_Root" directory according to the first metadata set.

[0168] See also Fig. 7A As shown, it is an interactive flow chart of information interaction between a user, a host, and a storage device during the stage of mounting the file system provided by an embodiment of the present application. The user sends a request message for mounting the file system to the host. After receiving the request message, the host generates a second custom command that conforms to the storage protocol command format, and sends the second custom command to the storage device. The storage device receives the second custom command, generates a second metadata set based on the second custom command, and determines the first metadata set based on the second metadata set to feed back to the host. The host receives the first metadata set, and constructs a file system based on the first metadata set, and mounts the constructed file system to an existing file system, so that the user can access the files in the file system corresponding to the first metadata set in a file system access manner based on, for example, a user interface provided by the existing file system, and convert the user's file access command into a custom command based on the file system corresponding to the first metadata set, so that the host can access the specified data corresponding to the file to be accessed by the user through the custom command or control the storage device to perform a specified operation.

[0169] In the above implementation scheme, the host sends a second custom command to the storage device based on the request information, the storage device generates a second metadata set based on the second custom command, and feeds back to the host a first metadata set determined based on the second metadata set, and the host mounts the file system constructed from the first metadata set in the existing file system, thereby mounting at least part of the content of the second metadata set to the existing file system. Figure 7B As shown, it is an example of generating the first metadata set based on the mapping relationship corresponding to the second metadata set.

[0170] It should be understood that in the implementation of the present application, the second custom command is different from the aforementioned first custom command or custom command. The aforementioned first custom command or custom command is used to instruct the storage device to access specified data or perform a specified operation, while the second custom command here is used to instruct the file system of the storage device to generate a second metadata set and send part or all of the second metadata set (the first metadata set) to the host.

[0171] In an optional embodiment of the present application, the host obtains the file-associated content according to a first metadata set in response to receiving a request from a user to access file-associated content in the host's file system, and outputs the file-associated content through the host's file system; and / or, in response to changing the file-associated content in the host's file system, outputs an error message through the host's file system.

[0172] In this embodiment, when the host receives an access command from a user to access file-associated content in the host's file system, it can directly obtain the file-associated content that the user wants to access from the first metadata set, and output it through the host's file system, so that the user obtains the required file-associated content.

[0173] Among them, the file-related content may include file names, directory names, file-directory mapping relationships, etc. For example, the operation type of the user's access command is ls, which indicates listing the files and directories under a specified directory of the file system (such as the directory corresponding to the file path indicated by the command). The host can obtain the files and directories under the specified directory in the first metadata set based on the command and output them through the host's file system.

[0174] It should be noted that the mapping relationship in the second metadata set is determined by the storage device, and may be specifically determined according to configuration information, or determined by a developer writing a code.

[0175] If the file and directory information in the file system is changed, it may cause the subsequent user to be unable to find the corresponding file or directory when accessing it in the file system mode. Therefore, the file and directory are generally not allowed to be changed. When a change command to change the file-related content in the host's file system is received, an error message can be directly output through the host's file system. For example, if a rename command sent by a user to change the name of a file or directory is received, the host side directly outputs an error message; or, if an rm command sent by a user to delete a specified file or directory is received, the host side directly outputs an error message.

[0176] The above implementation scheme, when receiving an access command to access the file-associated content in the host's file system, does not need to generate a custom command, and directly outputs the file-associated content required by the user through the host's file system, thereby improving processing efficiency; when receiving a change command to change the file-associated content in the host's file system, an error message is output to avoid changing the metadata set on the host side.

[0177] In an optional embodiment, when the storage device provides new accessible designated data and / or executable designated operations, the new designated data and / or designated operations can be provided with corresponding names (file names) and paths in the "SSD_Root" directory or its subdirectories, and the new designated data and / or designated operations have corresponding "indexes" (storage device memory addresses, NAND flash physical addresses, or function pointers). The mapping relationship between the file path or file index corresponding to the new designated data and / or designated operations and their corresponding "indexes" is recorded in the second metadata set. The directory structure of the "SSD_Root" directory in the second metadata set is also updated. Thus, when the host requests the first metadata set through the second custom command, the storage device generates the first metadata set using the updated second metadata set. The host uses the first metadata set to construct a file system for the "SSD_Root" directory, which already includes new files corresponding to the new designated data and / or designated operations. Users still use their familiar file system operation methods to access these new files, so that the learning cost will not be increased for users. In the host, the first metadata set is updated, but the way of using the first metadata set and the way of generating the first custom command do not need to be changed, so there is no need to redevelop the host program.

[0178] In an optional embodiment of the present application, the host can access the logical address space in the storage device in a block device manner. As an example, in response to a first access request for accessing the logical address space of the storage device through the host in a block device manner, the host determines the corresponding logical address and access type according to the first access request, generates a command that conforms to the storage protocol command format (hereinafter referred to as the storage protocol command) and sends it to the storage device; and receives a third response from the storage device to the storage protocol command. The first access request sent by the user to the host may carry path information and type information such as the file name and file path. The host determines the logical address (LBA address) to be accessed based on the path information, generates a storage protocol command based on the LBA address and type information, and sends the storage protocol command to the storage device.

[0179] The storage device accesses the logical address space based on the storage protocol command, generates a third response based on the access status of the logical address space, and feeds back the third response to the host. The host receives the third response fed back by the storage device to the storage protocol command, and feeds back the third response to the user, so that the user can access the logical address space of the storage device in a block device manner through the host.

[0180] Storage protocol commands are different from custom commands. For example, storage protocol commands are NVMe commands. The NVMe protocol defines the format of NVMe commands and the content they carry (such as LBA addresses). Custom commands can carry custom content (such as file indexes and file paths).

[0181] In an optional embodiment of the present application, the host can use the file system provided by the embodiment of the present application to access the logical address space of the storage device. As an example, in response to accessing the second file of the file system through the host's file system, a fourth custom command that conforms to the storage protocol command format is generated according to the second path corresponding to the second file, and the fourth custom command is sent to the storage device, wherein the second file is stored in the logical address space of the storage device; a fourth response fed back by the storage device to the fourth custom command is received, a fifth response for accessing the second file is generated according to the fourth response, and the fifth response is output through the host's file system.

[0182] In this embodiment, the second file is associated with data in the logical address space, and the user operates the host to access the data in the logical address space of the storage device by accessing the second file through the file system of the embodiment of the present application. The fourth custom command is used to instruct the host to access the data in the logical address space of the storage device. When the user accesses the second file stored in the logical address space of the storage device through the file system of the host, the host generates the fourth custom command and sends it to the storage device, and the storage device responds, thereby accessing the logical address space of the storage device by generating a custom command.

[0183] See also Figure 8 As shown, it is a schematic diagram of accessing the logical address space of a storage device through a host in block device mode, accessing the logical address space of a storage device through a host using a custom command, accessing one or more specified data included in the storage device through a host using a custom command, and / or controlling the storage device to perform specified operations.

[0184] In an optional embodiment of the present application, the host can use the file system provided by the embodiment of the present application to access the logical address space of the storage device. As an example, in response to accessing the third file of the file system through the file system of the host, a first IO command conforming to the storage protocol command format is generated, and the first IO command is sent to the storage device; a sixth response fed back by the storage device to the first IO command is received; wherein the third file is stored in the logical address space of the storage device.

[0185] In this embodiment, when the user accesses the data in the logical address space in the form of a file system, the host generates an IO command and sends it to the storage device by mounting the file system provided in the embodiment of the present application on the existing file system. The storage device responds to the received IO command, processes it, and feeds back the response corresponding to the IO command to the host, thereby realizing access to the logical address space by the file system provided in the embodiment of the present application.

[0186] The above is the introduction of the host accessing the storage device in the embodiment of the present application. By introducing the file system provided in the embodiment of the present application, the user appears to operate the host in a file system manner to access one or more specified data included in the storage device and / or control the storage device to perform specified operations, which simplifies the complexity of accessing the storage device. By accessing the logical address space of the storage device in a block device manner and accessing the logical address space of the storage device in a file system manner, different access paths to the logical address space are provided.

[0187] The following describes a storage device response method on the storage device side. The storage device provides a logical address space as a block device to the host. The storage device also includes one or more specified data and / or specified operations that can be accessed by the host. The logical address space does not include one or more specified data and / or specified operations. Fig. 9 As shown, the method includes:

[0188] Step 901: Receive a first custom command sent by a host, where the first custom command complies with a storage protocol command format and carries first path information corresponding to a first path of a file system of the host.

[0189] The first path in this embodiment is the first file accessed by the user through the file system of the host (eg Figure 4 When a user accesses a file through the host's file system, the host's file system generates a custom command that complies with the storage protocol command format based on the path information corresponding to the file. The storage device receives the custom command sent by the host and parses the custom command to obtain the command type and the path information carried by the command.

[0190] Step 902: In response to a first custom command, obtain a first index corresponding to the first path information.

[0191] After obtaining the first custom command, the storage device obtains the first index corresponding to the first path information based on the first custom command. It should be understood that the index corresponding to the path information obtained by the storage device in the embodiment of the present application may be different in form from the file index carried by the custom command. For example, if the file index is a hash value, a memory address of the storage device, a physical address of a NAND flash memory, or a function pointer, in this case, the "file index" is the same as the "index".

[0192] Step 903: access one of the one or more specified data according to the first index and / or perform one of the one or more specified operations according to the first index, and obtain a corresponding result.

[0193] Step 904: Generate a first response according to the corresponding result and send it to the host.

[0194] The first response fed back by the storage device is the response data corresponding to the first custom command, and the first custom command corresponds to the first file that the user wants to access. The first file is associated with specified data and / or specified operations, and the first custom command corresponds to the specified data and / or specified operations associated with the first file. The storage device can access the specified data associated with the first file and / or perform the specified operation associated with the first file based on processing the first custom command, so that from the user's perspective, the host is controlled to access the specified data in the storage device or the storage device is controlled to perform a specified operation by accessing the file.

[0195] Since the host accesses the specified data of the storage device and / or controls the storage device to perform specified operations, it provides a custom command to the storage device, and the custom command indicates path information, where the path information includes but is not limited to a file index or a file path. When the storage device receives and processes the custom command, it needs to convert the path information indicated by the custom command into the memory address of the storage device, the physical address of the NAND flash memory, or a function pointer, etc. The storage device maintains a second metadata set to provide a mapping from the path information to the memory address of the storage device, the physical address of the NAND flash memory, or a function pointer. The second metadata set has been introduced on the host side above and will not be repeated here.

[0196] The path information is the file index or the file path of the file system; Fig. 9 In response to the first custom command, obtaining the first index corresponding to the first path information includes one of the following steps:

[0197] Extracting a first index corresponding to the first path information from a first custom command;

[0198] Extracting the first path information from the first custom command, and determining a first index corresponding to the first path information based on the second metadata set;

[0199] A first index is calculated and generated according to the first path information extracted from the first custom command.

[0200] Optionally, if the first path information carried by the first custom command is a file index, and the file index is in the same index format as the index corresponding to the path information, such as the memory address of the storage device, the physical address of the NAND flash memory, or a function pointer, the storage device can directly extract the file index from the first custom command and use the file index as the first index.

[0201] Optionally, if the first path information carried by the first custom command is a file path, the storage device generates a hash value based on the file path, determines the first index based on the hash value, or maps and obtains the memory address of the storage device, the physical address of the NAND flash memory, or a function pointer based on the file path by looking up a table (such as looking up a second metadata set).

[0202] By determining the first index based on the path information carried in the first custom command and using a corresponding strategy, an address or function pointer for accessing one of the one or more specified data and / or performing one of the one or more specified operations is obtained in a matching manner.

[0203] For the host side, the command type in the file access command received by the host side indicates the type of operation performed on the file or directory corresponding to the file path, such as ls, cat, echo>, exec, rename, rm, etc. shown above. After the file system provided in the embodiment of the present application receives the file access command from the user, it will determine the command type corresponding to the custom command based on the operation type indicated by the file access command. For example, based on the "cat" in the file access command, the command type is determined to be "read data", and the command type is marked as "read command" in the custom command to be generated. Based on this, the host assigns the type of operation performed by the user on the file or directory to the custom command through the file system, so the storage device can also verify that the user's access to the file through the host's file system is a legal operation process.

[0204] As an example, the second metadata set also provides an association relationship between attributes and indexes; for example, the attribute characterizes whether the specified data or specified operation indicated by the custom command is readable or read-only, writable or write-only, unreadable, unwritable, executable, or unexecutable, etc. After receiving the first custom command and obtaining the first index corresponding to the first path information, the storage device searches for the first attribute corresponding to the first index based on the second metadata set; detects whether the first attribute matches the operation type carried by the first custom command; if the first attribute matches the operation type, the storage device can execute the custom command to access the specified data associated with the first index and / or perform the specified operation, and can carry a prompt that the first attribute matches the operation type in the first response; if it is determined that the first attribute does not match the operation type corresponding to the first file, the storage device does not execute the custom command, and can directly return a first response that the first attribute does not match the operation type, so as to feedback an error message through the first response.

[0205] Among them, when the storage device determines that the first attribute matches the operation type corresponding to the first file, it can feedback prompt information to the host, and the host side determines that accessing the first file through the host's file system is a legal operation based on the prompt information; when the storage device determines that the first attribute does not match the operation type corresponding to the first file, it can output error information and feedback to the host, and the host determines that accessing the first file through the host's file system is an illegal operation based on the error information.

[0206] In an optional embodiment of the present application, before receiving the first custom command, the storage device receives a second custom command sent by the host, and the second custom command complies with the storage protocol command format; in response to the second custom command, a first metadata set is provided to the host; the first metadata set includes at least part of the data in the second metadata set.

[0207] Before generating the first custom command, the host side receives request information for mounting the file system, and the request information is, for example, a command sent by a user to the host to mount the file system of the embodiment of the present application. Based on the request information, the host generates a second custom command that conforms to the storage protocol command format, sends the second custom command to the storage device, and the storage device receives the second custom command. After receiving the second custom command, the storage device generates a second metadata set based on the second custom command, sends part or all of the content in the second metadata set as the first metadata set to the host, and the host receives the first metadata set and mounts the file system constructed from the first metadata set in the existing file system.

[0208] For the introduction of the first metadata set and the second metadata set, the first custom command and the second custom command, and the interaction between the user, the host, and the storage device during the file system mounting phase, please refer to the relevant introduction on the host side, which will not be repeated here.

[0209] The following introduces a solution for a storage device to access specified data and / or perform a specified operation based on a first index.

[0210] As an optional implementation, the storage device reads the specified data according to the address corresponding to the first index; or writes the specified data to the address corresponding to the first index.

[0211] As an example, the storage device can determine that the address corresponding to the index according to the path information indicated by the custom command can be in various forms, including but not limited to the storage device memory address, NAND flash memory physical address, or register address, etc. It has been described above that when the host converts the user's file access command into a custom command based on the file system provided in the embodiment of the present application, the command type of the custom command can be generated based on the user's operation type on the file or directory. For example, the command type includes but is not limited to read, write, erase, etc. If the type of the custom command is a read command, the storage device will read data from the address indicated by the index determined according to the path information indicated by the custom command; if the type of the custom command is a write command, the storage device will write data to the address indicated by the index determined according to the path information indicated by the custom command. For example, see Figure 8 As shown, at least one of the CPU frequency, storage medium wear and debugging information is written or read to the address corresponding to the index based on the custom command.

[0212] The storage device determines an index to read or write data according to the path information indicated by the custom command, and can also perform at least one specified operation according to the determined index. As an example, when the operation type carried by the first custom command corresponds to an execution operation, the storage device can execute one of the one or more specified operations by running the program code at the address corresponding to the first index; for example, by running the program code at the address corresponding to the first index, a fault is injected into the test.

[0213] As another example, when the operation type carried by the first custom command corresponds to a write operation, data can be written to the address corresponding to the first index based on the write operation corresponding to the first custom command, and one of the one or more specified operations can be controlled to be performed based on the written data, such as writing configuration parameters to the register address corresponding to the first index. After writing the configuration parameters to the address corresponding to the first index, one of the one or more specified operations is performed based on the configuration parameters, such as controlling the storage device to perform debug mode switching based on the configuration parameters in the register, switching the mode of the storage device to normal mode when the configuration parameters in the register are 1, and switching the mode of the storage device to debug mode when the configuration parameters in the register are 0.

[0214] As another example, when the first index is a function pointer, the storage device calls the function pointer corresponding to the first index, calls or executes the function represented by the function pointer, and provides a parameter representing the password value to the function to implement password setting.

[0215] As another example, the storage device may determine the index according to the path information indicated by the custom command to read the specified data and perform the specified operation, or may only read the specified data or only perform the specified operation, which is not limited here.

[0216] In an optional embodiment of the present application, the logical address space can be accessed in a block device manner. In response to receiving an access request from a user, the host generates a storage protocol command that satisfies the storage protocol according to the access request from the user, and accesses the logical address space in the storage device through the storage protocol command. For example, the storage protocol command indicates the logical address of the logical address space to be accessed, and the storage device determines the physical address corresponding to the logical address based on the relationship between the logical address and the physical address maintained by it (such as the FTL table), reads data, writes data, or executes a command (such as executing an erase command) at the physical address to achieve access to the logical address space. The storage device can generate a third response based on the access result and feed it back to the host.

[0217] In an optional embodiment of the present application, the logical address space can also be accessed using the file system method provided in the embodiment of the present application. The host receives a file access command sent by a user to access file A in the file system, wherein file A is associated with data stored in the logical address space of the storage device. The file system provided in the embodiment of the present application mounted on the existing file system of the host generates a first IO command that complies with the storage protocol based on the file access command to access file A, wherein the first IO command is used to indicate access to data in the logical address space. The first IO command, for example, carries a logical address corresponding to the logical address space. The storage device receives the first IO command sent by the host, parses the first IO command to obtain a logical address from the first IO command, determines the corresponding physical address (physical address in the NVM flash memory chip) based on the logical address, reads the data stored at the physical address or writes data to the physical address, and generates a sixth response provided to the host based on the access result.

[0218] Based on the file system provided in the embodiment of the present application, users can access the data stored in the logical address space of the storage device in a file system manner. Accessing the data stored in the logical address space of the storage device in a file system manner is just the user's view that various files are operated in a file system manner (files represent the specified data or operations of the storage device), and the host and the storage device actually interact through IO commands (storage protocol commands), which does not change the way the host and the storage access the logical address space.

[0219] The logical address space is accessed using the file system method provided in the embodiment of the present application. The file system provided in the embodiment of the present application mounted on the existing file system of the host can not only generate IO commands that comply with the storage protocol based on the user's file access commands, but also generate custom commands that comply with the storage protocol based on the user's file access commands.

[0220] In an optional embodiment of the present application, the storage device receives a fourth custom command sent by the host, the fourth custom command is generated based on the second path corresponding to the second file and conforms to the storage protocol command format, the second file is a file accessed through the host's file system and stored in the logical address space; in response to the fourth custom command, a fourth response corresponding to the fourth custom command is fed back to the host, and the host generates a fifth response for accessing the second file based on the fourth response, and outputs the fifth response through the host's file system.

[0221] The above is an introduction to the storage device's response to the host's access in the embodiment of the present application. By introducing the file system provided in the embodiment of the present application, the user appears to operate the host in a file system manner to access one or more specified data included in the storage device and / or control the storage device to perform specified operations, thereby simplifying the complexity of accessing the storage device. By generating a second metadata set and feeding back to the host a first metadata set determined based on the second metadata set, at least part of the content of the mapping relationship can be mounted to the host's file system. When the user accesses the logical address space in a block device manner and accesses the logical address space of the storage device in a file system manner, different access paths to the logical address space are provided by feeding back information to the host.

[0222] An embodiment of the present application also provides a host, including: a memory for storing instructions executed by at least one processor; a processor for executing the instructions stored in the memory to perform the various processes of the above-mentioned method embodiment for accessing the storage device, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0223] An embodiment of the present application also provides a storage device, including: a memory, used to store instructions executed by at least one processor; a processor, used to execute the instructions stored in the memory to perform the various processes of the above-mentioned storage device response method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0224] An embodiment of the present application also provides a storage system, comprising the above-mentioned host and storage device.

[0225] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application. Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these 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 also intended to include these modifications and variations.

Claims

1. A method for accessing a storage device, characterized in that: Applied to a host, the storage device provides a logical address space as a block device to the host, the storage device also includes one or more specified data and / or specified operations accessible by the host; the logical address space does not include the one or more specified data and / or specified operations; the method includes: In response to accessing a first file of the file system through the file system of the host, generating a first custom command conforming to a storage protocol command format according to a first path corresponding to the first file, and sending the first custom command to the storage device; receiving a first response fed back by the storage device in response to the first custom command, generating a second response for accessing the first file according to the first response, and outputting the second response through the file system of the host; The first response corresponds to one of the one or more specified data and / or specified operations associated with the first file.

2. The method according to claim 1, characterized in that The step of generating a first custom command conforming to a storage protocol command format according to the first path corresponding to the first file comprises one of the following steps: Determine a first file index according to the first path, and generate the first custom command carrying the first file index; According to the first path, the first custom command carrying the first path is generated.

3. The method according to claim 2, characterized in that The host includes a first metadata set, wherein the first metadata set records a mapping relationship between a file path and the one or more specified data and / or specified operations; The determining the first file index according to the first path includes: Determine a first file index corresponding to the first path from the first metadata set, where the first file index is used to index one of the one or more specified data and / or specified operations corresponding to the first file; or The first file index is generated by calculation according to the first path.

4. The method according to claim 3, characterized in that The mapping relationship includes a first sub-mapping relationship between the file path and the file index; The determining, from the first metadata set, a first file index corresponding to the first path includes: Based on the first sub-mapping relationship recorded in the first metadata set, a first file index corresponding to the first path is determined.

5. The method according to claim 3 or 4, characterized in that: The mapping relationship includes a second sub-mapping relationship among the file index, the file attribute, and the address; the method further includes: Determining an operation type of accessing the first file through the file system of the host; Searching for a first file attribute corresponding to the first file index based on the second sub-mapping relationship, and detecting whether the first file attribute matches the operation type; In the case where the first file attribute matches the operation type, the step of generating a first custom command conforming to the storage protocol command format and sending the first custom command to the storage device is performed.

6. The method according to any one of claims 1 to 5, characterized in that: Before generating a first custom command conforming to a storage protocol command format according to a first path corresponding to the first file, the method further includes: Receive request information for mounting a file system; In response to the request information, generate a second custom command that complies with the storage protocol command format, and send the second custom command to the storage device; Receive a first metadata set fed back by the storage device in response to the second custom command, and mount a file system constructed from the first metadata set on the file system of the host; wherein the first metadata set includes at least part of the content in the second metadata set obtained by the storage device based on the second custom command.

7. The method according to any one of claims 3 to 6, characterized in that: The method further comprises: In response to accessing the file-associated content in the file system of the host, obtaining the file-associated content according to the first metadata set, and outputting the file-associated content through the file system of the host; and / or In response to changing the file-associated content in the file system of the host, error information is output through the file system of the host.

8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: In response to accessing a second file of the file system through the file system of the host, generating a fourth custom command conforming to a storage protocol command format according to a second path corresponding to the second file, and sending the fourth custom command to the storage device, wherein the second file is stored in a logical address space of the storage device; A fourth response fed back by the storage device to the fourth custom command is received, a fifth response for accessing the second file is generated according to the fourth response, and the fifth response is output through the file system of the host.

9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: In response to accessing a third file of the file system through the file system of the host, generating a first IO command that complies with a storage protocol command format, and sending the first IO command to the storage device; receiving a sixth response fed back by the storage device in response to the first IO command; The third file is stored in the logical address space of the storage device.

10. A host, characterized in that: include: a memory for storing instructions executed by at least one processor; A processor, configured to execute instructions stored in a memory to execute the steps of the method for accessing a storage device as described in any one of claims 1 to 9.