Method for responding to FPGA (Field Programmable Gate Array) equipment access by using file system and related product
The storage device receives and processes custom commands sent by the FPGA device, and uses the file system to process the basic operation of the file system, solving the performance bottlenecks of the FPGA device when accessing the storage device and the difficulty of file system development, and achieving high-performance file access and host recognition capabilities.
Patent Information
- Application Number
- CN202311628321.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2025-05-30
AI Technical Summary
When using storage devices, the CPU performance of embedded devices based on FPGAs is limited, resulting in performance bottlenecks when accessing storage devices; at the same time, it is difficult to develop FPGA simulated file systems.
The storage device receives the basic operation of the file system sent by the FPGA device and follows the custom commands of the NVMe protocol, processes these commands using the file system, and generates response information and sends it back to the FPGA device.
It is implemented that FPGA devices that do not have a file system use storage devices in high performance in the form of files, and enable the host to recognize and access files written by the FPGA device without changing the host.
Smart Images

Figure CN120067064A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage technologies, and in particular, to a method and related products for using a file system to respond to access by an FPGA device. Background Art
[0002] FIG. 1 shows a block diagram of a storage device. The storage device 102 is coupled to a host and is used to provide storage capabilities for the host. The host and the storage device 102 can be coupled in various ways, including but not limited to connecting the host and the solid-state storage device 102 through various 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), NVMe (NVM Express), Ethernet, Fibre Channel, wireless communication networks, etc. The host can be an information processing device capable of communicating with the storage device in the above ways, 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 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 can be adapted to exchange data with the host through, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fibre Channel, etc.
[0005] The control component 104 is used to control data transfer 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, wear leveling, bad block management, etc. The control component 104 can be implemented in multiple 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, and software is executed in the processor or controller to manipulate the hardware of the control component 104 to process IO (Input / Output) commands. The control component 104 is also coupled to the DRAM 110 and can access the data in the DRAM 110. The FTL table and / or the data of the cached IO commands can be stored in the DRAM.
[0006] The control component 104 includes a flash interface controller (or a media interface controller, a flash channel controller). The flash interface controller is coupled to the NVM chip 105 and issues commands to the NVM chip 105 in a manner that follows the interface protocol of the NVM chip 105 to operate the NVM chip 105 and receives the command execution results output from the NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI", etc.
[0007] Figure 1B A detailed block diagram of the control component of the storage device is shown.
[0008] The host accesses the storage device with read / write commands that follow the NVMe protocol. The control component generates one or more media interface commands based on the NVMe commands from the host and provides them to the media interface controller. The media interface controller generates storage media access commands (such as programming commands, read commands, erase commands) that follow the interface protocol of the NVM chip based on the media interface commands. The control component also tracks that all media interface commands generated from one NVMe command have been executed and indicates the processing results of the NVMe command to the host.
[0009] See Figure 1B, the control component includes, for example, a host interface, a host command processing unit, a storage command processing unit, a media interface controller, and a storage media management unit. The host interface obtains the NVMe commands provided by the host and generates storage commands to be provided to the storage command processing unit. The storage commands access the storage space of the same size, such as 4KB for example. The data unit corresponding to the data accessed by a storage command recorded in the NVM chip is called a data frame. A physical page records one or more data frames. For example, if the size of a physical page is 17664 bytes and the size of a data frame is 4KB, then one physical page can store 4 data frames.
[0010] The storage media management unit maintains the conversion from logical addresses to physical addresses for each storage command. For example, the storage media management unit includes an FTL table. For a read command, the storage media management unit outputs the physical address corresponding to the logical address accessed by the storage command. For a write command, the storage media management unit allocates an available physical address for it and records the mapping relationship between the accessed logical address and the allocated physical address.
[0011] The storage command processing unit, according to the physical address provided by the storage media management unit, operates the media interface controller to issue a storage media access command to the NVM chip. For the sake of clarity, the command sent by the host to the storage device is called an NVMe command, the command sent by the host command processing unit to the storage command processing unit is called a storage command, the command sent by the storage command processing unit to the media interface controller is called a media interface command, and the command sent by the media interface controller to the NVM chip is called a storage media access command. The storage media access command follows the interface protocol of the NVM chip.
[0012] The storage device can also be coupled with an FPGA-based embedded device to provide storage capabilities for the embedded device. There are usually the following two ways for an FPGA-based embedded device to use a storage device (such as an SSD (Solid State Disk)):
[0013] 1. Instantiate a CPU (Central Processing Unit) in the FPGA, run an operating system in the CPU, and use the storage device through the file system and the NVMe driver.
[0014] 2. Simulate a file system with the FPGA and generate NVMe commands to use the storage device. Summary of the Invention
[0015] For the above-mentioned first method, due to the limited performance of the CPU in the FPGA, running the operating system, file system, and NVMe driver introduces additional load to the CPU, resulting in the CPU performance becoming a bottleneck when accessing the storage device again; for the above-mentioned second method, relatively high performance can be achieved, but the development difficulty of simulating the file system on the FPGA is relatively large.
[0016] In view of the problems existing in the use of storage devices by FPGA-based embedded devices in the prior art, this application hopes to provide the ability to use storage devices in the form of files with high performance for embedded devices without a file system, and hopes that the host can recognize and access the files written by the FPGA to the storage device without modifying the existing host technology.
[0017] In a first aspect, an embodiment of this application provides a method for a storage device to respond, including:
[0018] The storage device receives a custom command sent by an FPGA device, which carries basic operations of the file system and complies with the NVMe protocol, where the FPGA device does not have the function of a file system;
[0019] The storage device processes the basic operations of the file system carried by the custom command using the file system and obtains a processing result;
[0020] The storage device generates response information for the custom command according to the processing result and sends it to the FPGA device.
[0021] Optionally, the method further includes:
[0022] The storage device extracts the operation type and file parameters of the basic operation of the file system from the custom command;
[0023] The storage device processes the basic operations of the file system carried by the custom command using the file system and obtains a processing result, including:
[0024] Through the file system in the storage device, at least one target storage command is generated according to the operation type and file parameters of the basic operation of the file system;
[0025] The at least one target storage command is processed to obtain the processing result.
[0026] Optionally, the custom command includes a first field for accommodating the operation type corresponding to the basic operation of the file system and a second field for indicating the PRPList.
[0027] Optionally, the custom command further includes: a third field; wherein, the third field accommodates a file parameter or a file parameter index indicating a basic operation of the file system; wherein, the file parameter index is used to index the file parameter.
[0028] Optionally, the storage device extracts the operation type and file parameter of the basic operation of the file system from the custom command, including:
[0029] Obtaining the operation type of the basic operation of the file system from the first field;
[0030] Obtaining the file parameter from a specified PRP entry of the PRPList.
[0031] Optionally, the storage device extracts the operation type and file parameter of the basic operation of the file system from the custom command, and further includes:
[0032] Obtaining the memory address of the FPGA device from other PRP entries other than the specified PRP entry of the PRPList, wherein the memory space represented by the memory address of the FPGA device is used to accommodate the processing result of the basic operation of the file system, or to accommodate the file data that the basic operation of the file system is to provide to the storage device.
[0033] Optionally, the second field indicating the PRPList records the index of the first PRP entry among multiple PRP entries of the PRPList index;
[0034] Obtaining the file parameter from a specified PRP entry of the PRPList includes:
[0035] Indexing to the first PRP entry among the multiple PRP entries according to the index of the first PRP entry;
[0036] Indexing to the memory address of the FPGA device according to the index of the first PRP entry, wherein the memory space represented by the memory address of the FPGA device is used to accommodate the file parameter.
[0037] Optionally, the storage device extracts the operation type and file parameter of the basic operation of the file system from the custom command, including:
[0038] Obtaining the operation type of the basic operation of the file system from the first field;
[0039] Obtaining the file parameter according to the third field; and
[0040] Obtain the memory address of the FPGA device from the PRP entry of the PRPList, where the memory space represented by the memory address of the FPGA device is used to accommodate the processing result of the basic file system operations or the file data that the basic file system operations are to provide to the storage device.
[0041] Optionally, obtain the file parameter according to the third field, including:
[0042] Obtain the file parameter directly from the third field; or
[0043] Obtain a file parameter index from the third field, and obtain the memory address of the FPGA device according to the file parameter index, where the memory address of the FPGA device accommodates the file parameter.
[0044] Optionally, the file parameter includes the file system path and file name of the file to be operated;
[0045] The file system in the storage device generates at least one target storage command according to the operation type and file parameter of the basic file system operation, including:
[0046] Generate at least one first storage command according to the file system path, and based on the at least one first storage command, find at least one LBA address in the file system metadata that records the file data of the file to be operated indicated by the file name;
[0047] Generate at least one second storage command to read the file data of the file to be operated indicated by the file name from the at least one LBA address; or generate at least one second storage command to write the file data of the file to be operated indicated by the file name to the at least one LBA address;
[0048] Wherein, the storage command is used to access the LBA space of the storage device; the file system metadata and file data are recorded in the LBA space of the storage device;
[0049] The file system metadata is recorded at a specified position in the LBA space of the storage device;
[0050] The file system in the storage device manages the file data through the file system metadata;
[0051] The at least one target storage command includes the at least one first storage command and the at least one second storage command.
[0052] Optionally, the storage device processes the at least one first storage command to obtain, from the file system metadata, a first type of inode corresponding to the directory where the file to be operated, indicated by the file name in the file system path, is located, obtains, according to the first type of inode, a second type of inode that records at least one LBA address of the file data of the file to be operated indicated by the file name, and obtains at least one LBA address of the file data of the file to be operated indicated by the file name from the second type of inode.
[0053] Optionally, if the operation type of the file system basic operation indicates a file reading operation, the storage device generates response information of the custom command according to the processing result and sends it to the FPGA device, including:
[0054] Moving the file data of the file to be operated indicated by the file name to the memory address of the FPGA device obtained from the PRP entry of the PRPList;
[0055] If the operation type of the file system basic operation indicates a file writing operation, the at least one second storage command is used to write the data obtained from the memory address of the FPGA device obtained from the PRP entry of the PRPList as the file data of the file to be operated indicated by the file name to the at least one LBA address; and the processing result indicates whether the file writing operation is successful or failed.
[0056] Optionally, the file parameter includes the file system path of the file to be operated;
[0057] The file system in the storage device generates at least one target storage command according to the operation type and file parameters of the file system basic operation, including:
[0058] Generating at least one first storage command according to the file system path, and based on the at least one first storage command, searching in the file system metadata for a first type of inode that records the directory indicated by the file system path, and obtaining information about all files and directories under the directory indicated by the file system path according to the first type of inode.
[0059] Among them, the storage command is used to access the LBA space of the storage device; the file system metadata is recorded at a specified location in the LBA space of the storage device;
[0060] The file system in the storage device manages file data through the file system metadata;
[0061] The at least one target storage command includes the at least one first storage command.
[0062] Optionally, the storage device generates response information of the custom command according to the processing result and sends it to the FPGA device, including:
[0063] Moving the information of all files and directories in the directory indicated by the file system path to the memory address of the FPGA device obtained from the PRP entry of the PRPList.
[0064] Optionally, the custom command further includes: a fourth field, where the fourth field contains indication information indicating the custom command format.
[0065] Optionally, the method further includes:
[0066] Identifying the custom command format corresponding to the custom command according to the indication information indicating the custom command format;
[0067] Parsing the custom command according to the custom command format.
[0068] Optionally, the custom command format corresponding to the custom command is one of the following cases:
[0069] The custom command includes a first field containing an operation type, a second field indicating a PRPList, and a third field containing a file parameter or a file parameter index indicating a basic file system operation, where the PRPList is used to index multiple PRP entries;
[0070] The custom command includes a first field containing an operation type and a second field indicating a PRPList.
[0071] Optionally, in response to writing file data in the form of a file system, the storage device records file system metadata and file data in the LBA space and mounts the file system metadata and file data to the host-specified file system path in the form of a directory.
[0072] Optionally, the method further includes:
[0073] The storage device disconnects from the FPGA device and establishes a connection with the host;
[0074] The host accesses the file written to the storage device by the FPGA device through an NVMe command, and the NVMe command is an NVMe read command or an NVMe write command.
[0075] Optionally, the file system of the host accesses the file system metadata and uses the file system metadata to identify the file data recorded in the LBA space of the storage device.
[0076] Optionally, the host generates basic file system operations;
[0077] The file system of the host generates NVMe commands to access the file system metadata and / or the file data in response to receiving the basic file system operations.
[0078] Optionally, the file system of the host extracts a first file system path and a first file name from the basic file system operations;
[0079] Generate at least one first NVMe command according to the first file system path, and find at least one LBA address of the file data of the file indicated by the first file name in the file system metadata based on the at least one first NVMe command;
[0080] Generate at least one second NVMe command to read out the file data of the file indicated by the first file name from the at least one LBA address; or generate at least one second NVMe command to write the file data of the file indicated by the first file name to the at least one LBA address;
[0081] Wherein, the first NVMe command and the second NVMe command are used to access the LBA space of the storage device; the file system metadata and the file data are recorded in the LBA space of the storage device;
[0082] The file system metadata is recorded at a specified position in the LBA space of the storage device;
[0083] The file system in the host manages the file data through the file system metadata.
[0084] Optionally, the host processes the at least one first NVMe command to obtain a first type of inode (i-node) corresponding to the directory where the file indicated by the first file name in the first file system path is located from the file system metadata, obtains a second type of inode recording at least one LBA address of the file data of the file indicated by the first file name according to the first type of inode, and obtains at least one LBA address of the file data of the file indicated by the first file name from the second type of inode.
[0085] Optionally, the method further includes:
[0086] The storage device responds to receiving an NVMe read command sent by the host, and the NVMe read command carries a target LBA address corresponding to target file data, and the target file data is file data written by the FPGA device to the storage device;
[0087] Access the LBA space of the storage device according to the target LBA address carried in the NVMe read command to read the target file data.
[0088] Optionally, when the storage device responds to the NVMe read command sent by the host, it further includes:
[0089] Send the read target file data to the host as the response information of the NVMe read command.
[0090] Optionally, the host determines the target LBA address corresponding to the target file data from the file system metadata and file data in the form of a directory under the specified file system path mounted on the host according to the file reading operation, and generates the NVMe read command based on the target LBA address.
[0091] In a second aspect, an embodiment of the present application provides a storage device, which includes a control component and a storage medium; wherein, the control component includes a host interface, a host command processing unit, a file system, and a storage command processing unit;
[0092] The host command processing unit receives, through the host interface, a custom command sent by an FPGA device that carries basic operations of a file system and follows the NVMe protocol, where the FPGA device does not have the function of a file system;
[0093] The file system receives the custom command sent by the host command processing unit, and generates at least one storage command according to the basic operations of the file system carried in the custom command;
[0094] The storage command processing unit receives at least one target storage command sent by the file system, processes the at least one target storage command to obtain a processing result, and generates response information of the custom command according to the processing result, and sends it to the FPGA device through the host command processing unit.
[0095] Optionally, the custom command includes a first field that accommodates an operation type corresponding to the basic operation of the file system and a second field that indicates a PRPList.
[0096] Optionally, the custom command further includes: a third field; wherein, the third field accommodates file parameters or file parameter indexes indicating the basic operations of the file system; wherein, the file parameter indexes are used to index file parameters.
[0097] Optionally, the file system obtains the operation type of the basic operation of the file system from the first field; and obtains file parameters from a specified PRP entry of the PRPList.
[0098] Optionally, the file system obtains the memory address of the FPGA device from other PRP entries outside the specified PRP entry of the PRPList, where the memory space represented by the memory address of the FPGA device is used to accommodate the processing result of the basic operation of the file system or the file data that the basic operation of the file system is to provide to the storage device.
[0099] Optionally, the file system obtains the operation type of the basic operation of the file system from the first field;
[0100] Obtain file parameters according to the third field; and
[0101] Obtain the memory address of the FPGA device from the PRP entry of the PRPList, where the memory space represented by the memory address of the FPGA device is used to accommodate the processing result of the basic operation of the file system or the file data that the basic operation of the file system is to provide to the storage device.
[0102] Optionally, the file parameters include the file system path and file name of the file to be operated;
[0103] The file system generates at least one first storage command according to the file system path; the storage command processing unit processes the at least one first storage command to access the LBA space of the storage device to obtain file system metadata; the file system searches in the file system metadata for at least one LBA address that records the file data of the file to be operated indicated by the file name;
[0104] The file system generates at least one second storage command; the storage command processing unit processes the at least one second storage command to read out the file data of the file to be operated indicated by the file name from the at least one LBA address; or write the file data of the file to be operated indicated by the file name to the at least one LBA address;
[0105] Wherein, the storage command is used to access the LBA space of the storage device; the file system metadata and file data are recorded in the LBA space of the storage device;
[0106] The file system metadata is recorded at a specified position in the LBA space of the storage device;
[0107] The file system manages file data through the file system metadata;
[0108] The at least one target storage command includes the at least one first storage command and the at least one second storage command.
[0109] Optionally, the file system obtains a first type of inode corresponding to the directory where the file to be operated, indicated by the file name in the file system path, is located, from the file system metadata, obtains a second type of inode that records at least one LBA address of the file data of the file to be operated indicated by the file name according to the first type of inode, and obtains at least one LBA address of the file data of the file to be operated indicated by the file name from the second type of inode.
[0110] In a third aspect, an embodiment of the present application provides a data processing system, including an FPGA device and a storage device, where the FPGA device does not have the function of a file system;
[0111] The FPGA device is coupled to the storage device and sends a custom command that carries basic file system operations and follows the NVMe protocol to the storage device;
[0112] The storage device processes the basic file system operations carried by the custom command using the file system and obtains a processing result;
[0113] The storage device generates response information of the custom command according to the processing result and sends it to the FPGA device.
[0114] Optionally, the storage device extracts the operation type and file parameters of the basic file system operation from the custom command, where the file parameters include the file system path and file name of the file to be operated;
[0115] The storage device generates at least one first storage command according to the file system path and searches for at least one LBA address of the file data of the file to be operated indicated by the file name in the file system metadata based on the at least one first storage command;
[0116] The storage device generates at least one second storage command and writes the file data of the file to be operated indicated by the file name to the at least one LBA address;
[0117] Wherein, the storage command is used to access the LBA space of the storage device; the file system metadata and file data are recorded in the LBA space of the storage device;
[0118] The file system metadata is recorded at a specified position in the LBA space of the storage device;
[0119] The file system in the storage device manages the file data through the file system metadata.
[0120] Optionally, the data processing system further includes a host, and the host has the function of a file system;
[0121] After the storage device disconnects from the FPGA device, the storage device establishes a connection with the host.
[0122] Optionally, the host generates basic operations of the file system, and the basic operations of the file system are read file operations for instructing to read the data of the target file, and the target file data is the file data written by the FPGA device to the storage device;
[0123] The host uses the file system to determine, in response to the basic operations of the file system, the target LBA address corresponding to the target file data from the file system metadata and file data in the form of a directory under the specified file system path mounted on the host, and generates an NVMe read command based on the target LBA address;
[0124] The host sends the NVMe read command carrying the target LBA address to the storage device.
[0125] Optionally, in response to the NVMe read command, the storage device accesses the LBA space of the storage device according to the target LBA address carried by the NVMe read command and reads out the target file data;
[0126] The storage device sends the read target file data to the host as the response information of the NVMe read command.
[0127] In a fourth aspect, an embodiment of the present application provides a data access method, including:
[0128] The FPGA device obtains first data to be written to the storage device;
[0129] The FPGA device sends a first custom command to the storage device to create a first file on the storage device, where the first custom command indicates the file system path and file name of the first file;
[0130] The FPGA device sends a second custom command to the storage device to write the first data into the first file, where the second custom command indicates the file system path and file name of the first file, and also indicates the address of the first data in the memory of the FPGA device; where
[0131] Neither the first custom command nor the second custom command includes the LBA address of the storage device;
[0132] In response to receiving the first custom command, the storage device extracts the type of the file system basic operation, as well as the file system path and file name of the first file from the first custom command. The storage device processes the file system basic operation carried by the first custom command by using the file system in the storage device, so as to record in the file system metadata in the LBA space of the storage device that the first file with the file name of the first file is created at the file system path of the first file, wherein the file system of the storage device processes the file system basic operation carried by the first custom command by generating one or more storage commands;
[0133] In response to receiving the second custom command, the storage device extracts the type of the file system basic operation, the file system path and file name of the first file, and the address of the first data in the memory of the FPGA device from the second custom command. The storage device processes the file system basic operation carried by the second custom command by using the file system in the storage device, so as to record the file data of the first file in the LBA space of the storage device, wherein the file data of the first file comes from the first data, and the file system of the storage device processes the file system basic operation carried by the second custom command by generating one or more storage commands;
[0134] Wherein, the storage command is used to access the LBA space of the storage device.
[0135] Optionally, the method further includes:
[0136] The host generates a file system basic operation;
[0137] The file system of the host extracts the file system path and file name of the first file from the received file system basic operation;
[0138] The file system of the host generates at least one first NVMe command according to the file system path and file name of the first file, and searches for at least one LBA address that records the file data of the file to be operated indicated by the file name of the first file in the file system metadata based on the at least one first NVMe command;
[0139] The file system of the host generates at least one second NVMe command to read out the file data of the file to be operated indicated by the file name of the first file from the at least one LBA address; or generates at least one second NVMe command to write the file data of the file to be operated indicated by the file name of the first file to the at least one LBA address;
[0140] Among them, the first NVMe command and the second NVMe command are used to access the LBA space of the storage device.
[0141] According to an embodiment of the present application, an FPGA device without a file system function sends a custom command carrying basic file system operations to a storage device, interacts with the storage device based on the custom command, and the storage device processes the basic file system operations by processing the custom command, so as to enable the FPGA device to access the storage device in a file system manner, which can provide the FPGA device with the ability to use the storage device in a high-performance file form. After the FPGA device writes file data to the storage device in a file system manner, the host accesses the file data written by the FPGA device to the storage device based on the file system through NVMe commands, so that the host can recognize and access the file data written by the FPGA device to the storage device without making any changes to the host. Description of the Drawings
[0142] FIG. 1 shows a block diagram of a storage device;
[0143] Figure 2A shows the format of a custom command provided by an embodiment of the present application;
[0144] Figure 2B shows the format of a custom command provided by another embodiment of the present application;
[0145] Figure 2C shows the format of a custom command provided by still another embodiment of the present application;
[0146] Figure 3A shows the format of a custom command provided by another embodiment of the present application;
[0147] Figure 3B shows the format of a custom command provided by another embodiment of the present application;
[0148] Figure 3C shows the format of a custom command provided by another embodiment of the present application;
[0149] Figure 4 shows a block diagram of a storage device supporting basic file system operations provided by an embodiment of the present application;
[0150] Figure 5 shows a schematic diagram of an FPGA device accessing a storage device through a custom command provided by an embodiment of the present application;
[0151] Figure 6 shows a schematic diagram of a host accessing a storage device through an IO command provided by an embodiment of the present application;
[0152] Figure 7Block diagram showing a storage device provided by another embodiment of the present application;
[0153] Figure 8 Block diagram showing a storage device provided by another embodiment of the present application.
[0154] Related technical terms
[0155] Basic operations of the file system: Implement basic operations on files such as reading, writing, deleting, opening, or creating files in the form of a file system;
[0156] Custom command: A command that conforms to the storage protocol definition in terms of command form or format and carries basic operations of the file system;
[0157] File system: An executable program that provides file system functions, or a hardware unit that implements file system functions;
[0158] File system data: Includes file system metadata and file data. File system metadata is used to describe the hierarchical directory structure of the file system, the attributes of files / directories, the storage location of file data, etc.; File data represents the data that constitutes the file itself;
[0159] File system path: Describes the path of a directory / file in the hierarchical directory structure of the file system.
[0160] OP: Indicates the operation type corresponding to the basic operation of the file system;
[0161] FILEOBJ: Indicates the file parameter corresponding to the basic operation of the file system;
[0162] PRP List: Used to index multiple PRP entries in a read operation or a write operation. Each PRP entry is used to index a fixed-size (such as 4K) host memory or FPGA device memory;
[0163] File system metadata: Used to describe the logical address of the file data managed by the file system in the LBA space;
[0164] inode: A data structure that constitutes file system metadata. File system metadata includes multiple inodes. Each inode can have a specific size and is recorded in the logical address space of the storage device. Detailed implementation manners
[0165] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of the present application.
[0166] In the embodiments of the present application, the FPGA-based embedded device (hereinafter referred to as the FPGA device) does not mount a file system, does not run a software-based file system, and does not include a hardware unit that provides file system functions. The storage device includes a file system in the form of software or hardware, and the host runs a software-based file system. The FPGA device without a file system can access the storage device in a high-performance manner in the form of a file by sending a custom command carrying the basic operations of the file system to the storage device. For the files written by the FPGA device to the storage device, the host can access the file data written by the FPGA device based on the mounted file system, so as to realize accessing the data written by the FPGA device in the storage device without making any improvements to the host.
[0167] In the embodiments of the present application, the FPGA device and the storage device interact through custom commands, and the FPGA device accesses the storage device in the form of a file based on the interaction of the custom commands. The custom commands conform to the storage protocol definition (such as the NVMe protocol) in terms of command form or format. The custom commands carry the basic operations of the file system, and the specific information indicated by the command content is different based on the different command types (operation types of the basic operations of the file system). By using custom commands (carrying the basic operations of the file system) to interact between the FPGA device and the storage device, the storage device can process the basic operations of the file system by processing the custom commands, and the FPGA device can access the storage device in the manner of a file system.
[0168] Among them, the basic operations of the file system include, for example, the following operations:
[0169] fopen(file_path_name) indicates to open or create a file, where file_path_name is, for example, a string representing the file system path and file name of the file to be operated;
[0170] fwrite(file_path_name, data) indicates to write file data, where file_path_name represents the file system path and file name of the file to be operated, and data represents the data to be written;
[0171] fread(file_path_name, buf) indicates reading file data, where file_path_name represents the file system path and file name of the file being operated on, and buf represents the memory buffer for holding the read data;
[0172] fdelect(file_path_name) indicates deleting file data, where file_path_name represents the file system path and file name of the file being operated on;
[0173] fset(file_path_name, attribute, value) indicates setting and modifying file attributes, where file_path_name represents the file system path and file name of the file being operated on, attribute represents the name of the attribute to be modified, and value represents the new value of the attribute;
[0174] flist(file_path) indicates listing all files and directories under the specified file system path, where file_path represents the specified file system path;
[0175] fsquery indicates querying the file system status, such as how many clusters there are in total in the current partition of the file system, the cluster size, whether each cluster is in use, etc.;
[0176] format indicates formatting the file system;
[0177] fmnt indicates mounting and unmounting the file system;
[0178] fdisk indicates partition creation and management operations, such as creating partitions, deleting partitions, viewing partitions, etc.
[0179] Correspondingly, the FPGA device of the embodiment of the present application accesses the storage device in the form of a file to use the logical address space provided by the storage device. The FPGA device sends a custom command carrying the basic operations of the file system according to the embodiment of the present application to the storage device, to instruct the storage device to provide the functions of the file system by processing the custom command, so as to realize that the FPGA device accesses the storage device in the file system manner.
[0180] After the FPGA device writes file data to the storage device in the form of a file, the file system metadata and file data are recorded in the LBA space of the storage device. The organization method / data structure of the file system metadata and file data (collectively referred to as file system data) is the same as that of the file system data generated by the software-form file system in the host, so that the software-form file system in the host can directly recognize the file system data of the storage device and mount it in the form of a directory to the specified file system path of the host.
[0181] The file data written by the host to the storage device when accessing the FPGA device is in the form of a file system. Thus, the host generates NVMe IO commands in an existing technical solution (such as through a software-form file system and an NVMe driver running on the host) to access the files written by the FPGA device in the storage device. When a user operates the host to access the files written by the FPGA device in the storage device, the user only needs to access these files through the file system method of the existing technology without modifying the host.
[0182] It should be noted that the embodiments of the present application can be understood as follows: The FPGA device sends a custom command carrying basic file system operations to the storage device, and the storage device processes the basic file system operations by processing the custom command, so as to enable the FPGA device to access the storage device in the form of a file system. After the FPGA device writes file data to the storage device in the form of a file system, the host accesses the file data written by the FPGA device to the storage device based on the IO command between the file system and the storage device, so that the host can recognize and access the file data written by the FPGA device to the storage device without modifying the host.
[0183] The following introduces the custom commands for interaction between the FPGA device and the storage device. Basic file system operations are encapsulated in custom commands that conform to, for example, the NVMe protocol. According to the custom commands of the embodiments of the present application, it includes at least a field for accommodating OP, a field for accommodating PRPList, and an optional field for accommodating FILEOBJ.
[0184] The custom command has a size specified by, for example, the NVMe protocol. For example, the custom command includes 16 DWORDs (double words, each DWORD being 64 bits in size). Different DWORDs indicate different contents. For example, the 10th DWORD is OP, indicating the operation type of the basic file system operation, which can indicate fopen, fwrite, fread, flist, etc.; the 11th DWORD is FILEOBJ, indicating the file parameters corresponding to the basic file system operation, including file_Path_name, attribute, etc. (for example, it can include all parameters except data and buf); the 12th and 13th DWORDs are PRPList, indicating the memory space of the host or the FPGA device corresponding to data and buf.
[0185] Since the string length of the file_path_name indicated by FILEOBJ is uncertain and may exceed the size of the custom command, the size of data / buf will change with the data size of reading and writing files and often exceed the size of the custom command. Therefore, an improved technical solution is needed to enable the custom command with a fixed size and format to carry various basic file system operations and file parameters, as well as data / buf, whose length / format / quantity change in the basic file system operations.
[0186] Figure 2A Shows the format of the custom command provided by an embodiment of the present application.
[0187] As an example, see Figure 2A , the custom command carrying the basic file system operation includes a field for accommodating OP, a field for accommodating FILEOBJ, and a field for accommodating PRPList. The field for accommodating OP is, for example, 10 bits in size, the field for accommodating FILEOBJ is, for example, 1 DWORD in size, and the field for accommodating PRPList is, for example, 1 or several DWORDs in size. As an example, the same format as that for carrying PRPList in the NVMe IO command in the NVMe protocol is adopted to carry PRPList in the custom command of the embodiment of the present application.
[0188] Since 1 DWORD only includes 64 bits and the field for accommodating FILEOBJ is, for example, 1 DWORD in size, when accommodating FILEOBJ, the information carried by FILEOBJ cannot exceed 64 bits. For example, when the custom command indicates fileopen(file_path_name), FILEOBJ includes file_path_name, and the size of file_path_name cannot exceed 64 bits. For example, for fileopen(" / a.o”), its file path length is small, so it can be carried by Figure 2A the custom command format shown. For example, for fileopen(" / root / bin / foo.txt”), its file path length far exceeds 64 bits, so it cannot be carried by Figure 2A the custom command format shown.
[0189] In Figure 2A 's embodiment, PRPList includes, for example, 1 or 2 PRP entries, which are fully accommodated in the custom command. When PRPList includes, for example, more PRP entries, these PRP entries cannot be accommodated by the custom command due to the excessive quantity, so the custom command format shown by Figure 2A cannot be adopted.
[0190] Figure 2BShows the format of the custom command provided by another embodiment of the present application.
[0191] As an example, refer to Figure 2B , the custom command carrying the basic operations of the file system includes a field for accommodating OP, a field for accommodating FILEOBJ ptr, and a field for accommodating PRPList. The field for accommodating OP is, for example, 10 bits in size, the field for accommodating FILEOBJ ptr is, for example, 1 DWORD in size, and the field for accommodating PRPList is, for example, 1 or several DWORDs in size. As an example, the PRPList is carried in the custom command of the embodiment of the present application in the same format as the NVMe IO command in the NVMe protocol carrying the PRPList.
[0192] In Figure 2B the shown custom command, there is no field directly accommodating FILEOBJ, but a field for accommodating FILEOBJ ptr. FILEOBJ ptr indicates the FILEOBJ index (such as FILEOBJ pointer), which is used to index the FILEOBJ recorded in the specified memory space. And the FILEOBJ index, as an index for indexing FILEOBJ, has a size independent of the size of FILEOBJ, and as an index, its size does not exceed 64 bits. For example, the FILEOBJ index is 15 bits in size, and it can be fully accommodated by, for example, 1 DWORD in size (64 bits).
[0193] As an example, in the custom command indicating fdelect(file_path_name), where file_path_name is " / root / bin / foo.txt", its size exceeds 64 bits. Since FILEOBJ exceeds 64 bits, it cannot be directly accommodated in the custom command by 1 DWORD. The embodiment of the present application adopts Figure 2B the shown custom command format. The custom command does not directly accommodate FILEOBJ, but records the FILEOBJ index by setting the field of FILEOBJ ptr in the custom command, and then indexes to the specified memory space through the FILEOBJ index, and FILEOBJ is recorded in the specified memory space. For example, the specified memory space size is 4KB, which is sufficient to accommodate " / root / bin / foo.txt".
[0194] Figure 2C Shows the format of the custom command provided by yet another embodiment of the present application.
[0195] As an example, refer to Figure 2C, the custom commands that carry out the basic operations of the file system do not directly accommodate the fields of FILEOBJ, but only include the fields that accommodate OP and the fields that accommodate PRPList. The field that accommodates OP is, for example, 10 bits in size, and the field that accommodates PRPList is, for example, 1 or several DWORDs in size. As an example, in the custom commands of the embodiments of the present application, the index of the first PRP entry of PRPList (such as the pointer to the first PRP entry) is recorded in the field that accommodates PRPList. The field that accommodates PRPList records the index of the first PRP entry of PRPList, and this index is used to index the first PRP entry of PRPList (such as PRP0). Through the first PRP entry of PRPList, its corresponding memory space of a specified size (such as 4KB) is indexed, and FILEOBJ is recorded in this memory space, and then FILEOBJ is found.
[0196] As an example, for fileopen(" / root / bin / foo.txt”), the length of its file path far exceeds 64 bits, and FILEOBJ exceeds 64 bits. Since FILEOBJ exceeds 64 bits, it cannot be directly accommodated by 1DWORD in the custom command. The embodiments of the present application adopt Figure 2C the custom command format shown. FILEOBJ is not directly accommodated in the custom command, but is recorded in the memory space corresponding to the first PRP entry. By recording the index of the first PRP entry of PRPList in the field that accommodates PRPList in the custom command, the first PRP entry is indexed through the index of the first PRP entry, and then the memory space corresponding to it is indexed through the first PRP entry to find FILEOBJ. FILEOBJ is stored in a memory space of, for example, 4KB, and the 4KB memory space is sufficient to accommodate " / root / bin / foo.txt”.
[0197] Also as an example, PRPList includes 11 PRP entries, namely PRP0, PRP1, PRP2, PRP3, PRP4, PRP5, PRP6, PRP7, PRP8, PRP9, and PRP10. Since PRPList includes more PRP entries, these PRP entries cannot be accommodated by the custom command due to their excessive number. The embodiments of the present application adopt Figure 2CThe custom command format shown is such that the field in the custom command that holds the PRPList does not directly hold the PRP entries corresponding to the PRPList itself, but rather records the index of the first PRP entry in the PRPList. The indices of the other PRP entries in the PRPList are determined based on the index of the first PRP entry, and the corresponding PRP entries are indexed according to the indices of each PRP entry. For example, the index of the second PRP entry in the PRPList = the index of the first PRP entry in the PRPList + 1, and so on to obtain the indices of the other PRP entries in the PRPList. In the memory space indicated by the other PRP entries (except the first PRP entry) in the PRPList, data and buf are recorded. As Figure 2C The custom command format shown can support the case where the PRPList includes more PRP entries. For the above several custom command formats, both the FPGA device and the storage device can accept them. For custom commands in different formats, the storage device uses different methods for parsing. In some embodiments, the FPGA device and the storage device agree on the custom command format to be used. In other embodiments, in order for the storage device to recognize which format the custom command adopts, a flag field is also carried in the custom command, and the flag field is used to indicate which format the custom command adopts. The storage device recognizes the corresponding format based on the content recorded in the flag field and thus recognizes each field of the custom command. As an example, Figure 3A represents the format of the custom command provided by another embodiment of the present application. Refer to Figure 3A , the value of the flag field in the custom command is flag0, indicating that the custom command format is Figure 2A the format shown; Figure 3B represents the format of the custom command provided by another embodiment of the present application. Refer to Figure 3B , the value of the flag field in the custom command is flag1, indicating that the custom command format is Figure 2B the format shown; Figure 3C represents the format of the custom command provided by another embodiment of the present application. Refer to Figure 3C , the value of the flag field in the custom command is flag2, indicating that the custom command format is Figure 2C the format shown.
[0198] Figure 4 Shows a block diagram of a storage device that supports basic operations of a file system provided by an embodiment of the present application.
[0199] As an example, the storage device includes a control component, such as Figure 4As shown, the control component includes a host interface, a host command processing unit, a file system (implemented in the form of software or hardware), a storage command processing unit, a media interface controller, and a storage media management unit. The storage device is coupled to, for example, a host or an FPGA device.
[0200] The storage device is coupled to an FPGA device, and the host command processing unit receives, through the host interface, a custom command sent by the FPGA device that carries basic operations of the file system. After receiving the custom command that carries basic operations of the file system, the host command processing unit forwards the basic operations of the file system carried by the custom command to the file system.
[0201] The file system generates one or more storage commands according to the type of the basic operations of the file system and file parameters, and provides the generated storage commands to the storage command processing unit. When the control component processes the custom command sent by the FPGA device that carries basic operations of the file system, the file system provides the storage commands to the storage command processing unit, rather than Figure 1B as shown, the host command processing unit provides the storage commands to the storage command processing unit. The storage commands provided by the file system to the storage command processing unit are the same as the storage commands sent by the host command processing unit to the storage command processing unit in terms of format, carried information, etc. when the control component processes NVMe commands sent by the host.
[0202] The storage command processing unit processes the storage commands. The storage media management unit maintains the conversion from logical addresses to physical addresses for each storage command. The storage command processing unit generates media interface commands according to the physical addresses provided by the storage media management unit, and issues storage media access commands to the NVM chip by operating the media interface controller through the media interface commands. It should be understood that when the control component processes the custom command sent by the FPGA device that carries basic operations of the file system, the processing procedures of the storage command processing unit, the storage media management unit, and the media interface controller in the control component are similar to those when processing NVMe commands sent by the host.
[0203] When the storage device is coupled to the host, the process of the control component in the storage device processing NVMe commands sent by the host can be referred to Figure 1B and will not be elaborated here.
[0204] For a storage device, its LBA space is divided into two parts, which are respectively used to record file system metadata and file data. For example, a specified area of the LBA space records file system metadata, and the file system metadata is used to describe the recording location (logical address) of the file data managed by the file system in the LBA space. Different file systems have different formats, meanings, and recording locations for their file system metadata. For example, for the FAT file system, the file system metadata is the FAT table, which is located at the start and end positions of the LBA space; for the XFS file system, the file system metadata includes a superblock, inodes (i-nodes), free space information, etc., which are located at the start position of the LBA space. And different file systems have the same organization / data structure for their file system data.
[0205] The following introduces the process of an FPGA device accessing a storage device based on a custom command.
[0206] Figure 5 Shows a schematic diagram of an FPGA device accessing a storage device through a custom command provided by an embodiment of the present application.
[0207] In Figure 5 the file system metadata is located at the start position of the LBA space. Refer to Figure 5 , after the FPGA device generates a custom command carrying basic file system operations, it sends the custom command to the storage device. The host command processing unit in the control component of the storage device receives the custom command through the host interface. In response to the custom command carrying basic file system operations (such as based on the content of OP), it forwards the basic file system operations carried by the custom command to the file system. In response to receiving the basic file system operations, the file system generates one or more storage commands according to the type of the basic file system operations and file parameters to process the basic file system operations, and optionally returns a processing result to the host command processing unit. Among them, the custom command carries at least OP and file parameters. When the custom command indicates a read file operation or a write file operation, it also includes a PRPList representing buf or dataf. When the custom command indicates a list file operation, the custom command includes a PRPList indicating buf.
[0208] As an example, the custom command sent by the FPGA device, fread(file_path_name, buf), indicates a file reading operation. Since there are various possibilities for the path length of the file data to be accessed by the custom command sent by the FPGA device and various possibilities for the depth of the file system path, after the file system receives fread(file_path_name, buf), it issues one or more storage commands according to file_path_name to find and read inode_D (denoted as inode_D) in the file system metadata that records the directories at all levels under the file system path indicated by file_path_name.
[0209] After obtaining inode_D that records the directory where the file to be read indicated by file_path_name is located, one or more inodes (denoted as inode_F) that record the file data of the file to be read indicated by file_path_name are obtained according to this inode_D. In the case of a large file, it corresponds to multiple inode_F. The file system obtains the LBA addresses in the LBA space where the file data is stored based on inode_F and generates one or more storage commands to read out the file data.
[0210] For example, for fread(“ / root / abc.txt”, buf), first, the inode (inode_D) representing the root directory “ / ” is read through a storage command. This inode is located at a known position in the LBA space, and the LBA address of the inode representing the directory “root” is obtained from this inode. Subsequently, the inode (inode_D) representing the directory “root” is read through another storage command, and the LBA address of the inode (inode_F) representing the file “abc.txt” is obtained from this inode. Next, the inode (inode_F) representing the file “abc.txt” is read through another storage command, and the LBA address of the storage location of the file data of the file “abc.txt” itself is obtained from this inode; then, the file data of the file “abc.txt” is read through a further storage command. Optionally, when the file “abc.txt” is large, there are multiple inode_F recording the LBA addresses of the storage locations of the file data of the file “abc.txt” itself.
[0211] Still as an example, the fwrite(file_path_name, data) carried by the custom command sent by the FPGA device indicates a file writing operation. For fwrite(" / root / a.so", data), first, the inode (inode_D) representing the root directory " / " is read through a storage command. This inode is located at a known position in the LBA space, and the LBA address of the inode representing the directory "root" is obtained from this inode. Subsequently, the inode (inode_D) representing the directory "root" is read through another storage command, and the LBA address of the inode (inode_F) representing the file "a.so" is obtained from this inode. Next, the inode (inode_F) representing the file "a.so" is read through yet another storage command, and the LBA address of the storage location of the file data itself representing the file "a.so" is obtained from this inode; then the file data of "a.so" is written through a further storage command. Optionally, a new LBA space is allocated for the file "a.so" to accommodate more file data, and the LBA address of the newly allocated LBA space is recorded in inode_F. Data is also written to the newly allocated LBA address through a storage command. Still optionally, if the original inode_F cannot accommodate more LBA addresses, a new inode_F is also allocated, and in addition to writing the file data to the newly allocated LBA address through a storage command, the newly allocated inode_F is written to the LBA space through a storage command, which becomes part of the file system metadata.
[0212] The storage commands generated by the file system are processed by the storage command processing unit. For example, for fwrite(file_path_name, data), the storage command processing unit determines the physical address (PPA) corresponding to the LBA carried by the received storage command in response to the received storage command, generates a media interface command carrying the PPA, and provides it to the media interface controller. Since the media interface command carries the physical address, the logical unit to be accessed is determined based on the physical address carried by the media interface command, and a storage medium access command is generated and sent to the corresponding logical unit to achieve writing file data to the corresponding physical page.
[0213] The control component generates a completion message and sends it to the FPGA device in response to the completion of the processing of the custom command indicating the fwrite(file_Path_name, data) operation.
[0214] For another example, for fread(file_path_name, buf), the storage command processing unit determines the physical address (PPA) corresponding to the LBA carried in the storage command in response to the received storage command, generates a media interface command carrying the PPA, and provides it to the media interface controller. Since the media interface command carries the physical address, the logical unit to be accessed is determined based on the physical address carried in the media interface command, and a storage media access command is generated and sent to the corresponding logical unit to read the data within the physical page indicated by the PPA. The file system manages file system metadata and file data in the LBA space and is not aware of the physical address.
[0215] After reading the file data based on fread(file_path_name, buf), the control component moves the read data to the memory space buf described by the PRPList, and generates a completion message in response to the completion of the processing of the custom command indicating the fread(file_path_name, buf) operation and sends it to the FPGA device.
[0216] In another example, the flist(file_path) carried in the custom command sent by the FPGA device indicates an operation to list all files and directories under the specified file system path. For example, for flist(" / root / Directory1"), first, the inode (inode_D) representing the root directory " / " is read through a storage command. This inode is located at a known position in the LBA space, and the LBA address of the inode representing the directory "root" is obtained from this inode. Subsequently, the inode (inode_D) representing the directory "root" is read through another storage command, and the LBA address of the inode representing the directory "Directory1" is obtained from this inode. Next, the inode (inode_D) representing the directory "Directory1" is read through yet another storage command. The LBA addresses of the inodes of all files and directories under the file system path " / root / Directory1" are recorded in this inode, and based on this, all files and directories under the file system path " / root / Directory1" are enumerated.
[0217] The above describes the cases where the custom commands sent by the FPGA device carry fread(file_path_name, buf), fwrite(file_path_name, data), and flist(file_path). The custom commands sent by the FPGA device to the storage device can also carry other information and indicate other types of operations, which are not listed and elaborated one by one here.
[0218] According to the embodiments of the present application, the FPGA device issues a custom command carrying basic file system operations to the storage device, and a directory structure and the written files are formed in the LBA space of the storage device. For example, the custom commands successively issued by the FPGA device to the storage device carry fwrite(" / root / bin / foo.s", "aabbccdd"), fwrite(" / root / dev / abc.txt", "hello"), fwrite(" / root / bar.dat", "……"), and after the storage device processes these custom commands, file system data with the following structure is formed in the logical address space of the storage device:
[0219] / root
[0220] / bin / foo.s
[0221] / dev / abc.txt
[0222] bar.dat
[0223] Among them, / root, / bin, and / dev represent directories, / bin and / dev are subdirectories of / root, and foo.s, abc.txt, and bar.dat represent files. The foo.s file is located in the / bin directory, the abc.txt file is located in the / dev directory, and the bar.dat file is located in the / root directory.
[0224] Thus, even if the FPGA device does not include a file system, it can still write files located in a specified file system path to the storage device in a file manner. Moreover, the file data written by the FPGA device according to the embodiments of the present application to the storage device can be recognized by a host including a file system in the prior art without modifying the host.
[0225] After the FPGA device writes file data to the storage device based on a custom command, the host can access the written file data of the FPGA device through the file system. The process of the host accessing the written file data of the FPGA device through the file system is introduced below.
[0226] Figure 6 It is a schematic diagram of the host accessing the storage device through an IO command provided by the embodiments of the present application.
[0227] See Figure 6 , the host includes a file system, an application program, and an NVMe driver ( Figure 6 not marked in Figure 5The file systems in the control components shown are different. The file system in the host includes file system metadata.
[0228] For an application running on the host to read file data, it issues basic file system operations to the file system running on the host. The file system of the host, based on the received basic file system operations, issues one or more NVMe read commands to the storage device through, for example, an NVMe driver. The storage device processes the NVMe read commands in the manner of the prior art (see Figure 1B ), and provides the read file data to the host.
[0229] For the host, it generates basic file system operations by running an application. The file system of the host determines the LBA where the file data to be operated is stored based on the file system path (file_path_name) of the file to be operated in the basic file system operation and the file system metadata. The file system sends the LBA to, for example, an NVMe driver, and generates an NVMe command based on the LBA by running the NVMe driver. The LBA space used by the file system of the storage device is the same as the LBA space provided by the storage device to the host. Thus, the host can access the LBA space of the storage device through the NVMe command, enabling the host to write data to the LBA space of the storage device through the NVMe command and also access the file data stored in the LBA space of the storage device.
[0230] As an example, the basic file system operation is a file read operation indicated by fread(“ / root / bar.dat”, buf). The file system of the host finds and reads the inode (inode_D) representing the root directory “ / ” in the file system metadata, reads the inode ((inode_D) representing the directory “root” from this inode, and obtains the inode (inode_F) representing the file “bar.dat” from this inode, and obtains the LBA address of the storage location of the file data itself representing the file “bar.dat” from this inode, and sends the LBA to the NVMe driver. The NVMe driver generates an NVMe read command based on the LBA. The storage device receives the NVMe read command. The host command processing unit of the storage device receives the NVMe command, sends a corresponding storage command to the storage command processing unit, and the storage command processing unit reads the file data to be read from the LBA space of the storage device based on the LBA carried in the storage command, realizing the reading of the file data written by the FPGA device from the storage device based on the NVMe read command sent by the host.
[0231] As an example, the specific application scenarios of the embodiments of the present application include the first stage of writing file data into an FPGA device and the second stage of the host reading the file data written by the FPGA device. The first stage occurs at the data acquisition site, where the FPGA device writes the acquired data into the storage device without the participation of the host. Thus, the FPGA device and the storage device can form a miniaturized or dedicated system processing system, which is deployed or applied in occasions such as the field, ships, spacecraft, factories, etc., to write the acquired on-site data into the storage device in the form of files in a high-speed and low-power manner. The second stage occurs in, for example, a data center or a laboratory for analyzing data. The laboratory has information processing devices with complete functions and sufficient performance, such as a host, to read the file data from the storage device and perform analysis.
[0232] In the first stage (data acquisition and recording stage), the FPGA device is connected to the storage device, and the acquired on-site data is written into the storage device in the way of file operations. The process of the FPGA device writing file data into the storage device can be referred to the above relevant description and will not be elaborated here. Since the FPGA device does not need to implement a file system, its performance can be fully used for data acquisition and generating custom commands, and a higher data throughput bandwidth can be achieved.
[0233] In the second stage, the storage device is disconnected from the FPGA device and connected to the host; the host reads the file data written by the FPGA device into the storage device through the file system with an NVMe read command, and the storage device processes the NVMe read command sent by the host in the existing manner.
[0234] Figure 7 It is a block diagram of a storage device provided by another embodiment of the present application.
[0235] As an example, refer to Figure 7 , the control components of the storage device include control circuit 701 and control circuit 702. A file system as shown in Figure 4 and Figure 5 is loaded in control circuit 702. The storage device is coupled to the host and / or the FPGA device. The host sends NVMe commands (NVMe read or NVMe write commands) to the storage device to access the storage device. For example, the FPGA device is the FPGA device as shown in Figure 5 , and the FPGA device sends a custom command (referred to as custom command B) to the storage device to access the storage device in the way of the file system. For NVMe commands, the storage device is processed by control circuit 701, and for custom commands, control circuit 701 and control circuit 702 need to cooperate to process. It should be understood that the custom command sent by the FPGA device to the storage device indicates the basic operations of the file system, and the FPGA device controls the storage device to access the LBA space in the way of the file system through this custom command.
[0236] In the case where the FPGA device sends a custom command to the storage device, the host command processing unit of the control circuit 701 receives the custom command, sends the basic file system operation indicated by the custom command to the control circuit 702, and the file system loaded in the control circuit 702 generates a storage command carrying the LBA according to the received basic file system operation and sends it to the storage command processing unit in the control circuit 701. The storage command processing unit determines the PPA corresponding to the LBA carried by the storage command, and provides the PPA to the media interface controller in the form of a media interface command. The media interface controller determines the logical unit to be accessed based on the physical address carried by the media interface command, and determines the LUN controller corresponding to the accessed logical unit based on the mapping relationship between the logical unit and the LUN controller. The LUN controller processes the media interface command, generates a storage medium access command and sends it to the corresponding logical unit.
[0237] In the case where the host sends an NVMe command to the storage device, the host command processing unit of the control circuit 701 receives the NVMe command and sends corresponding multiple storage commands to the storage command processing unit. The process of the storage command processing unit processing the storage commands can be referred to the above description and will not be elaborated here.
[0238] Figure 8 It is a block diagram of a storage device provided in another embodiment of the present application.
[0239] As an example, as Figure 8 shown, the control component includes a control circuit 801 and a control circuit 802. Among them, the control circuit 801 includes a CPU group 1 and a media interface controller, and is used to process NVMe commands such as NVMe write commands or NVMe read commands, so as to access the NVM chip based on the NVMe commands. The control circuit 802 includes a CPU group 2 and is used to process user-specified operations or basic file system operations. The host or the FPGA device performs data interaction with the control circuit 801 through the PCIe link. For example, when a user wants to access data in the NVM chip, the host generates an NVMe read command or an NVMe write command, and then sends the NVMe read command or the NVMe write command to the control circuit 801 through the PCIe link between the host and the control circuit 801. The host command processing unit, the storage command processing unit, the storage medium management unit and the media interface controller in the control circuit 801 process the NVMe read command or the NVMe write command and access the NVM chip.
[0240] Continue to refer to Figure 8, for example, CPU group 1 includes four CPU cores, namely CPU 1-0, CPU 1-1, CPU 1-2, and CPU 1-3. Optionally, a Real Time Operating System (RTOS) runs on the four CPU cores of CPU group 1. With the support of this operating system, CPU group 1 implements a host command processing unit, a storage command processing unit, and a storage medium management unit, and also provides functions such as managing the FTL table or garbage collection (GC). It can be understood that the implementation of the host command processing unit, the storage command processing unit, and the storage medium management unit may not depend on the operating system.
[0241] As an example, Figure 8 As shown, CPU group 2 includes four CPU cores, namely CPU 2-0, CPU 2-1, CPU 2-2, and CPU 2-3. A standard operating system (such as Linux) runs on the four CPU cores of CPU group 2. A remote connection tool (such as the Secure Shell protocol SSH (Secure Shell)), application programs, file systems, etc. are set on the standard operating system. The host (FPGA device) communicates with the control circuit 802 in the control component through, for example, SSH.
[0242] Figure 8 In the example of, control circuit 801 and control circuit 802 each include 4 CPU cores. It can be understood that each control circuit may include other numbers of CPU cores, and these CPU cores may be the same or different from each other. The number of CPU cores in control circuit 801 and control circuit 802 does not have to be the same either.
[0243] Still as an example, when the host communicates with the operating system / application program in control circuit 802, it can communicate through the PCIe link between control component 801 and the host. For example, the host carries communication or call requests for control circuit 802 through custom commands that comply with the NVMe protocol, and control circuit 801 forwards such communication or call requests to control circuit 802. The corresponding responses made by control circuit 802 are also returned to the host through control circuit 801 as responses to the custom commands.
[0244] Since the control circuit 802 runs a standard operating system, it becomes possible for users rather than the provider of the control component to develop programs that run in the control circuit 802 based on the standard operating system. Even without the assistance of the provider of the control circuit 802, users can use existing development tools and / or development tools provided by the provider of the control component to develop programs that run in the control circuit 802. Such programs can not only call the services of the standard operating system through the API, but also use the storage device services provided by the control circuit 801 based on, for example, the NVMe protocol. When using the storage device services, the transmission path of the read / write data occurs inside the storage device without being transmitted to the outside of the storage device via the PCIe link, enabling the data throughput to exceed the bandwidth provided by the PCIe link and resulting in lower processing latency.
[0245] The hardware accelerator of the control circuit 802 can also be used by programs developed by users that run in the control circuit 802. The hardware accelerator can be operated by user-developed application programs through the standard operating system, the hardware abstraction layer, and / or the board support package (BSP) as a device compatible with the standard operating system.
[0246] A file system (such as the file system shown in Figure 4 and Figure 5 ) is loaded on the standard operating system in the control circuit 802. In addition to processing NVMe commands sent by the host, the storage device can also process custom commands sent by the FPGA device indicating basic operations of the file system. The storage device processes the custom commands in a file system manner to access the file data indicated by the custom commands. The host command processing unit in the control circuit 801 receives, for example, custom commands carrying basic operations of the file system sent by the FPGA device. In response to the custom commands carrying basic operations of the file system, the host command processing unit forwards the basic operations of the file system carried by the custom commands to the file system in the control circuit 802. In response to receiving the basic operations of the file system, the file system generates one or more storage commands, which are provided to the storage command processing unit in the control circuit 801. The storage command processing unit obtains the PPA (the PPA corresponding to the LBA carried by the storage command) provided by the storage media management unit and provides the PPA to the media interface controller in the form of a media interface command. The subsequent processing flow is executed by the media interface controller.
[0247] In addition, the host can also send custom commands (not carrying basic operations of the file system) to the storage device to access the storage device. For example, the host can control the storage device to perform user-specified operations by indicating user-specified operations through the custom commands. Another example is that in the absence of a file system, the host can also send, as in the embodiments of this application Figure 5The custom commands shown are used to indicate basic file system operations to access storage devices in a file system manner. In Chinese patents with application numbers CN2023112835330 and CN2023112872541, the content such as the control component, the interaction process between the host and the storage device, and the process of the host accessing the storage device through custom commands is introduced, and the content is incorporated herein in this application.
[0248] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the present application. Obviously, those skilled in the art can make various changes and variations 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 equivalent technologies, the present application also intends to include these modifications and variations.
Claims
1. A method for a storage device to respond, characterized in that, comprising: The storage device receives a custom command sent by the FPGA device, which carries basic file system operations and follows the NVMe protocol. Among them, the FPGA device does not have the function of the file system; The storage device uses the file system to process the basic file system operations carried by the custom command and obtains a processing result; The storage device generates response information of the custom command according to the processing result and sends it to the FPGA device.
2. The method according to claim 1, characterized in that, further comprising: The storage device extracts the operation type and file parameters of the basic file system operation from the custom command; The storage device uses the file system to process the basic file system operations carried by the custom command and obtains a processing result, including: Through the file system in the storage device, at least one target storage command is generated according to the operation type and file parameters of the basic file system operation; Process the at least one target storage command to obtain the processing result.
3. The method according to claim 2, characterized in that, The custom command includes a first field for accommodating the operation type corresponding to the basic file system operation and a second field for indicating the PRPList.
4. The method according to claim 3, characterized in that, The custom command further includes: a third field; wherein, the third field accommodates the file parameters or file parameter indexes indicating the basic file system operation; wherein, the file parameter indexes are used to index the file parameters.
5. The method according to claim 4, characterized in that, The storage device extracts the operation type and file parameters of the basic file system operation from the custom command, including: Obtaining the operation type of the basic file system operation from the first field; Obtaining file parameters from the specified PRP entry of the PRPList.
6. The method according to any one of claims 2 to 5, characterized in that, The file parameters include the file system path and file name of the file to be operated; The generating at least one target storage command through the file system in the storage device according to the operation type and file parameters of the basic file system operation includes: Generating at least one first storage command according to the file system path, and searching for at least one LBA address recording the file data of the file to be operated indicated by the file name in the file system metadata based on the at least one first storage command; Generating at least one second storage command to read the file data of the file to be operated indicated by the file name from the at least one LBA address; or generating at least one second storage command to write the file data of the file to be operated indicated by the file name to the at least one LBA address; Among them, the storage command is used to access the LBA space of the storage device; the file system metadata and file data are recorded in the LBA space of the storage device; The file system metadata is recorded at a specified position in the LBA space of the storage device; The file system in the storage device manages file data through the file system metadata; The at least one target storage command includes the at least one first storage command and the at least one second storage command.
7. The method according to any one of claims 1 to 6, characterized in that further comprising: The storage device disconnects from the FPGA device and establishes a connection with the host; The host accesses the file written to the storage device by the FPGA device through an NVMe command, and the NVMe command is an NVMe read command or an NVMe write command.
8. A storage device, characterized in that The storage device includes a control component and a storage medium; wherein, the control component includes a host interface, a host command processing unit, a file system, and a storage command processing unit; The host command processing unit receives, through the host interface, a custom command sent by the FPGA device that carries basic operations of the file system and follows the NVMe protocol, wherein the FPGA device does not have the function of a file system; The file system receives the custom command sent by the host command processing unit, and generates at least one storage command according to the basic operations of the file system carried by the custom command; The storage command processing unit receives at least one target storage command sent by the file system, processes the at least one target storage command to obtain a processing result, and generates response information of the custom command according to the processing result, and sends it to the FPGA device through the host command processing unit.
9. A data processing system, characterized in that comprises an FPGA device and a storage device, and the FPGA device does not have the function of a file system; The FPGA device is coupled to the storage device and sends a custom command that carries basic operations of the file system and follows the NVMe protocol to the storage device; The storage device processes the basic operations of the file system carried by the custom command by using the file system and obtains a processing result; The storage device generates response information of the custom command according to the processing result and sends it to the FPGA device.
10. A data access method, characterized in that comprises: The FPGA device obtains first data to be written to the storage device; The FPGA device sends a first custom command to the storage device to create a first file on the storage device, wherein the first custom command indicates the file system path and file name of the first file; The FPGA device sends a second custom command to the storage device to write the first data to the first file, wherein the second custom command indicates the file system path and file name of the first file, and also indicates the address of the first data in the memory of the FPGA device; wherein Neither the first custom command nor the second custom command includes the LBA address of the storage device; In response to receiving the first custom command, the storage device extracts the type of the file system basic operation, as well as the file system path and file name of the first file, from the first custom command. The storage device processes the file system basic operation carried by the first custom command by using the file system in the storage device, so as to record in the file system metadata in the LBA space of the storage device that the first file with the file name of the first file is created at the file system path of the first file, wherein the file system of the storage device processes the file system basic operation carried by the first custom command by generating one or more storage commands; In response to receiving the second custom command, the storage device extracts the type of the file system basic operation, the file system path and file name of the first file, and the address of the first data in the memory of the FPGA device, from the second custom command. The storage device processes the file system basic operation carried by the second custom command by using the file system in the storage device, so as to record the file data of the first file in the LBA space of the storage device, wherein the file data of the first file comes from the first data, and the file system of the storage device processes the file system basic operation carried by the second custom command by generating one or more storage commands; Wherein, the storage command is used to access the LBA space of the storage device.