File system SSD with compression function

By introducing file systems into storage devices, processing custom commands of FPGA devices and implementing data compression, the CPU performance bottleneck and file system development difficulties in FPGA devices in storage devices are solved, and high-performance file access and storage device life extension are achieved.

CN120353375APending Publication Date: 2025-07-22CHENGDU STARBLAZE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410089650.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-22
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

In the prior art, when using storage devices, embedded devices based on FPGAs have problems such as CPU performance bottlenecks and difficult file system development, and the technical complexity caused by introducing data compression into the FTL table.

Method used

It provides a storage device that supports basic operations of the file system by receiving customized commands sent by the FPGA device to carry basic operations of the file system, using the file system to process these operations, and implements data compression and decompression in the storage device, supporting basic operations of the file system, such as writing files and reading files.

Benefits of technology

The FPGA device can access the storage device in a file form with high performance, reduce the amount of data writes, extend the life of the storage device, and enable the host to recognize and access files written by the FPGA without changing the host.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120353375A_ABST
    Figure CN120353375A_ABST
Patent Text Reader

Abstract

The invention provides a file system SSD (Solid State Disk) with a compression function, the SSD receives a custom command which is sent by FPGA (Field Programmable Gate Array) equipment, bears basic operation of a file system and follows an NVMe (Non-Volatile Memory Express) protocol, and the FPGA equipment does not have the function of the file system; processing a file system basic operation carried by the user-defined command by using the file system, and obtaining a processing result; generating response information of the self-defined command according to the processing result, and sending the response information to the FPGA equipment; the method comprises the following steps: in response to a file system basic operation instruction, writing a file, compressing the operated file indicated by the file system basic operation, and storing data corresponding to the compressed file into an LBA space of a storage device; or reading the file in response to the instruction of the basic operation of the file system, reading the data corresponding to the compressed file from the LBA space of the storage device, and decompressing the data to obtain the operated file indicated by the basic operation of the file system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technologies, and particularly to a file system SSD with a compression function. 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. For example, 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 can also be 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), and the flash interface controller is coupled to the NVM chip 105 and issues commands to the NVM chip 105 in a manner that complies with the interface protocol of the NVM chip 105 to operate the NVM chip 105 and receives 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 comply with 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 comply with the interface protocol of the NVM chip based on the media interface commands. The control component also tracks that all the media interface commands generated from one NVMe command have been executed and indicates the processing result 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, for example, storage spaces of the same size, such as 4KB. 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, based on 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 to an FPGA-based embedded device to provide storage capabilities for the embedded device. There are usually 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 a file system and an 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] Regarding the above-mentioned first method, since the CPU in the FPGA has limited performance, running the operating system, file system, and NVMe driver introduces additional load to the CPU. As a result, when accessing the storage device again, the performance of the CPU becomes a bottleneck. Regarding 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 high.

[0016] In view of the problems existing in the use of storage devices by FPGA-based embedded devices in the prior art, this application aims to provide the ability for embedded devices without a file system to use storage devices in a high-performance manner in the form of files, and also aims to enable the host to recognize and access the files written by the FPGA to the storage device without modifying the existing host.

[0017] Furthermore, data compression is a beneficial function for solid-state drives. By reducing the amount of data written, it reduces the occupation of storage space, and also reduces the wear of NVM chips, thereby extending the life of solid-state drives. However, in solid-state drives based on the FTL table, due to the uncertainty of the data unit size caused by compression, and the FTL table is designed to manage data units of a fixed size, this conflict makes implementing compression introduce great technical complexity to solid-state drives. The storage device of this application introduces a file system, and the file system provides convenience for implementing data compression. Therefore, the storage devices of some embodiments of this application also provide data compression capabilities through the file system.

[0018] In a first aspect, an embodiment of this application provides a method for a storage device to respond, including: receiving a custom command sent by an FPGA device that carries basic file system operations and follows the NVMe protocol, where the FPGA device does not have the function of a file system; using the file system to process the basic file system operations carried by the custom command and obtaining a processing result; generating response information for the custom command according to the processing result and sending it to the FPGA device; where, in response to the basic file system operation indicating writing a file, compressing the file indicated to be operated by the basic file system operation, and storing the data corresponding to the compressed file in the LBA space of the storage device; or in response to the basic file system operation indicating reading a file, reading the data corresponding to the compressed file from the LBA space of the storage device, and decompressing the data to obtain the file indicated to be operated by the basic file system operation.

[0019] According to the first storage device response method of the first aspect of the present application, a second storage device response method according to the first aspect of the present application is provided, including: in response to the file system basic operation instruction to write a file, the file system caches the first file data of the file to be operated indicated by the write file; and in response to all of the first file data being cached, the file system compresses the first file data to obtain first compressed file data; and stores the first compressed file data into the LBA space of the storage device.

[0020] According to the second storage device response method of the first aspect of the present application, a third storage device response method according to the first aspect of the present application is provided, wherein the second file name of the compressed file corresponding to the first file name of the file to be operated indicated by the write file is determined; the second file system path of the compressed file is determined according to the first file system path indicated by the write file; and the file system writes the first compressed file data according to the second file system path and the second file name.

[0021] According to the third storage device response method of the first aspect of the present application, a fourth storage device response method according to the first aspect of the present application is provided, wherein a first mapping relationship between the first file name and the second file name is recorded by using a first mapping table; or the second file name is obtained by performing a hash operation on the first file name.

[0022] According to the third or fourth storage device response method of the first aspect of the present application, a fifth storage device response method according to the first aspect of the present application is provided, wherein each directory name of the compressed file corresponding to each directory name in the first file system path is obtained, and the second file system path is obtained according to the directory name of the compressed file.

[0023] According to the fifth storage device response method of the first aspect of the present application, a sixth storage device response method according to the first aspect of the present application is provided, wherein a second mapping relationship between each directory name in the first file system path and the directory name of the compressed file corresponding thereto is recorded by a second mapping table; or the directory name of the compressed file corresponding to each directory name in the first file system path is obtained by performing a hash operation on each directory in the first file system path.

[0024] According to the second to sixth storage device response methods of the first aspect of the present application, the seventh storage device response method of the first aspect of the present application is provided. Among them, in response to the file system basic operation instructing to read a file, the file system determines the third file system path and the third file name corresponding to the file to be operated indicated by the read file; and determines the fourth file system path of the compressed file corresponding to the file to be operated indicated by the read file according to the third file system path; and determines the fourth file name of the compressed file corresponding to the file to be operated indicated by the read file according to the third file name; and reads the second compressed file data corresponding to the file to be operated indicated by the read file according to the fourth file system path and the fourth file name; and performs a decompression operation on the second compressed file data to obtain the second file data of the file to be operated indicated by the read file.

[0025] According to the third to seventh storage device response methods of the first aspect of the present application, the eighth storage device response method of the first aspect of the present application is provided. Among them, at least one first storage command is generated according to the second file system path, and at least one first LBA address recording the first compressed file data is found in the file system metadata based on the at least one first storage command; at least one second storage command is generated to write the first compressed file data to the at least one first LBA address; or at least one third storage command is generated according to the fourth file system path, and at least one second LBA address recording the second compressed file data is found in the file system metadata based on the at least one third storage command; and at least one fourth storage command is generated to read the second compressed file data from the at least one second LBA address.

[0026] According to the eighth storage device response method of the first aspect of the present application, a ninth storage device response method according to the first aspect of the present application is provided, wherein the at least one first storage command is processed, the first type of inode (i-node) corresponding to the directory where the first compressed file data indicated by the second file name in the second file system path is obtained from the file system metadata, the second type of inode recording at least one third LBA address of the first compressed file data is obtained according to the first type of inode, and at least one first LBA address of the first compressed file data is obtained from the second type of inode; or the at least one third storage command is processed, the third type of inode (i-node) corresponding to the directory where the first compressed file data indicated by the fourth file name in the fourth file system path is obtained from the file system metadata, the third type of inode recording at least one fourth LBA address of the second compressed file data is obtained according to the third type of inode, and at least one second LBA address of the second compressed file data is obtained from the third type of inode.

[0027] According to any one of the second to ninth storage device response methods of the first aspect of the present application, a tenth storage device response method according to the first aspect of the present application is provided. The storage device records file system metadata and file data in the LBA space in response to writing file data in the form of a file system, and mounts the file system metadata and file data in the form of a directory to a host-specified file system path.

[0028] According to any one of the first to tenth storage device response methods of the first aspect of the present application, an eleventh storage device response method according to the first aspect of the present application is provided, further including that in response to the file system basic operation instruction to write a file, the file system splits the file data of the file to be operated indicated by the write file into multiple first data blocks with a specified size; and the file system respectively performs a compression operation on each first data block to obtain its corresponding compressed second data block; and stores the second data block corresponding to each first data block in the LBA space of the storage device.

[0029] According to the eleventh storage device response method of the first aspect of the present application, a twelfth storage device response method according to the first aspect of the present application is provided, wherein the file system allocates one or more LBA addresses to each second data block, generates a fifth storage command according to each LBA address; processes one or more fifth storage commands corresponding to each second data block, and stores each second data block in the LBA space of the storage device.

[0030] According to the eleventh or twelfth storage device response method of the first aspect of the present application, the thirteenth storage device response method of the first aspect of the present application is provided, further including: the file system records the third mapping relationship between the file name and the LBA address in an associated manner.

[0031] According to any one of the eleventh to thirteenth storage device response methods of the first aspect of the present application, the fourteenth storage device response method of the first aspect of the present application is provided, wherein, in response to the file system basic operation being to read a file, the file system determines at least one LBA address corresponding to the file to be operated indicated by the read file; and generates a sixth storage command according to each LBA address, reads each second data block corresponding to the file to be operated indicated by the read file from the LBA space of the storage device according to the sixth storage command; and performs a decompression operation on each second data block to obtain the first data block corresponding to each second data block before compression; and sequentially combines each first data block to obtain the file to be operated indicated by the read file.

[0032] According to any one of the eleventh to thirteenth storage device response methods of the first aspect of the present application, the fifteenth storage device response method of the first aspect of the present application is provided, wherein, in response to the file system basic operation indicating to read a file, wherein the read file indicates to read partial file data in the file to be operated; the file system determines the range of the partial file data, determines the first data block corresponding to the partial file data according to the range; and determines the second data block corresponding to the determined first data block, and determines the LBA address corresponding to the second data block; and generates a seventh storage command according to the LBA address corresponding to the second data block, reads the second data block from the LBA space of the storage device according to the seventh storage command; and performs a decompression operation on the second data block to obtain the first data block corresponding to it, and obtains the partial file data according to the first data block.

[0033] According to any one of the first to fifteenth storage device response methods of the first aspect of the present application, the sixteenth storage device response method of the first aspect of the present application is provided, wherein, in response to the file system basic operation indicating to write a file, the file system splits the file data of the file to be operated indicated by the write file into multiple third data blocks, and generates an eighth storage command for each third data block according to the LBA address represented by the file pointer; wherein the size of each third data block is the same as the storage space size indicated by each LBA address; processes the eighth storage command corresponding to each third data block, performs a compression operation on each third data block to obtain the compressed fourth data block; and sequentially stores the fourth data block corresponding to each third data block into the LBA space of the storage device.

[0034] According to the sixteenth storage device response method of the first aspect of the present application, the seventeenth storage device response method of the first aspect of the present application is provided. Among them, in response to the processing completion of the eighth storage command corresponding to the previous third data block, the LBA address is carried in the storage command processing result, and the LBA address carried in the storage command processing result of the eighth storage command corresponding to the previous third data block is used as the file pointer of the next third data block.

[0035] According to the sixteenth or seventeenth storage device response method of the first aspect of the present application, the eighteenth storage device response method of the first aspect of the present application is provided. Among them, the eighth storage command corresponding to the third data block is processed, a compression operation is performed on the third data block to obtain the corresponding compressed fourth data block, and the size of the fourth data block is compared with the size of the remaining storage space corresponding to the LBA address represented by the file pointer of the third data block; the value of the LBA address carried in the storage command processing result corresponding to the third data block is determined according to the comparison result.

[0036] According to the eighteenth storage device response method of the first aspect of the present application, the nineteenth storage device response method of the first aspect of the present application is provided. Among them, if the size of the fourth data block is smaller than the size of the remaining storage space corresponding to the LBA address represented by the file pointer of the third data block, it is determined that the LBA address carried in the storage command processing result of the eighth storage command is the LBA address represented by the file pointer of the third data block; if the size of the fourth data block corresponding to the third data block is equal to the size of the remaining storage space corresponding to the LBA address represented by the file pointer of the third data block, it is determined that the LBA address carried in the storage command processing result corresponding to the eighth storage command is the LBA address represented by the file pointer of the third data block plus 1; and / or if the size of the fourth data block corresponding to the third data block is larger than the size of the remaining storage space corresponding to the LBA address represented by the file pointer of the third data block, it is determined that the LBA address carried in the storage command processing result corresponding to the eighth storage command is the LBA address represented by the file pointer of the third data block plus 1.

[0037] According to the nineteenth storage device response method of the first aspect of the present application, the twentieth storage device response method of the first aspect of the present application is provided. Among them, if the size of the fourth data block is not larger than the size of the remaining storage space corresponding to the LBA address represented by the file pointer of the third data block, the fourth data block is stored in the storage space corresponding to the LBA address represented by the file pointer of the third data block; and / or if the size of the fourth data block is larger than the size of the remaining storage space corresponding to the LBA address represented by the file pointer of the third data block, the fourth data block is stored in the storage space corresponding to the LBA address obtained by adding 1 to the LBA address represented by the file pointer of the third data block.

[0038] According to the nineteenth or twentieth storage device response method of the first aspect of the present application, a twenty-first storage device response method according to the first aspect of the present application is provided. Among them, if the size of the fourth data block is smaller than the size of the remaining storage space corresponding to the LBA address represented by the file pointer of the third data block, the size of the remaining storage space corresponding to the LBA address represented by the file pointer of the third data block is updated with the difference between the size of the remaining storage space corresponding to the LBA address represented by the file pointer of the third data block and the size of the fourth data block.

[0039] According to any one of the sixteenth to twenty-second storage device response methods of the first aspect of the present application, a twenty-third storage device response method according to the first aspect of the present application is provided. Among them, the file name, each third data block corresponding to the file, and the LBA address corresponding to each third data block are recorded in association with the file system.

[0040] According to the twenty-third storage device response method of the first aspect of the present application, a twenty-fourth storage device response method according to the first aspect of the present application is provided. Among them, the LBA address corresponding to each third data block is recorded in association with the file system as the LBA address represented by the file pointer of the third data block; or the LBA address corresponding to each third data block is recorded in association with the file system as the LBA address of the storage space where the fourth data block corresponding to the third data block carried in the corresponding storage command processing result is actually written.

[0041] According to the twenty-fourth or twenty-fifth storage device response method of the first aspect of the present application, a twenty-sixth storage device response method according to the first aspect of the present application is provided. Among them, in response to the basic operation of the file system being to read a file, the LBA addresses corresponding to each third data block of the file to be operated indicated by the read file are determined by using the file name, each third data block corresponding to the file, and the LBA address corresponding to each third data block recorded in association with the file system; a ninth storage command is generated according to each LBA address, and each ninth storage command is processed to read out the fourth data block corresponding to each third data block from the LBA space; the decompression operation is performed on each fourth data block to obtain its corresponding third data block, and each third data block is spliced in order to obtain the file to be operated indicated by the read file.

[0042] According to the twenty-fifth storage device response method of the first aspect of the present application, there is provided the twenty-sixth storage device response method of the first aspect of the present application. Among them, each ninth storage command is processed, and the fourth data block corresponding to each ninth storage command is decompressed to obtain the corresponding third data block; and the third data block corresponding to each ninth storage command is carried in the processing result of each ninth storage command and returned to the file system; the file system splices the respective third data blocks in sequence to obtain the operated file indicated by the read file.

[0043] According to any one of the twenty-third to twenty-sixth storage device response methods of the first aspect of the present application, there is provided the twenty-seventh storage device response method of the first aspect of the present application. Among them, in response to the file system basic operation being a read file operation, wherein the read file operation indicates that partial file data in the operated file indicated by the read file is to be read; the file system determines the range of the partial file data, determines the third data block corresponding to the partial file data according to the range; and determines the fifth LBA address corresponding to the third data block according to the file name, each third data block corresponding to the file, and the LBA address corresponding to each third data block associated with the file system; generates a tenth storage command according to the fifth LBA address corresponding to the third data block, and reads the third data block according to the tenth storage command.

[0044] According to the twenty-seventh storage device response method of the first aspect of the present application, there is provided the twenty-eighth storage device response method of the first aspect of the present application. Among them, if the third data block read out by processing the tenth storage command includes the partial file data to be read, return the partial file data to be read; and / or if the third data block read out by processing the tenth storage command does not include the partial file data to be read, add 1 to the fifth LBA address to obtain the sixth LBA address; and generate an eleventh storage command according to the sixth LBA address, read the corresponding third data block according to the eleventh storage command, extract the partial file data to be read from the third data block corresponding to the eleventh storage command, and return the partial file data to be read.

[0045] According to any one of the eleventh to twenty-eighth storage device response methods of the first aspect of the present application, there is provided the twenty-ninth storage device response method of the first aspect of the present application, which records the data blocks after compression corresponding to the file system metadata and the file data in the LBA space.

[0046] According to the second aspect of the present application, a first storage device according to the second aspect of the present application is provided. The storage device includes a control component and a storage medium. Among them, 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 an FPGA device that carries basic operations of the file system and follows the NVMe protocol. Among them, the FPGA device does not have the function of the file system. The file system, in response to the file system basic operation indicating writing a file, compresses the file indicated to be operated on by the file system basic operation, generates a storage command, and stores the data corresponding to the compressed file in the LBA space of the storage device. Or, in response to the file system basic operation indicating reading a file, generates a storage command to read the data corresponding to the compressed file from the LBA space of the storage device, and decompresses the data to obtain the file indicated to be operated on by the file system basic operation. And the storage device command processing unit processes the storage command generated by the file system.

[0047] According to the first storage device of the second aspect of the present application, a second storage device according to the second aspect of the present application is provided. Among them, the file system, in response to the file system basic operation indicating writing a file, caches the first file data of the file indicated to be operated on by the write file. And in response to all of the first file data being cached, the file system compresses the first file data to obtain first compressed file data. And generates a storage command to store the first compressed file data in the LBA space of the storage device.

[0048] According to the first storage device of the second aspect of the present application, a third storage device according to the second aspect of the present application is provided. Among them, the file system, in response to the file system basic operation indicating writing a file, splits the file data of the file indicated to be operated on by the write file into multiple first data blocks of a specified size. And respectively performs a compression operation on each first data block to obtain its corresponding compressed second data block. Generates a storage command to store the second data block corresponding to each first data block in the LBA space of the storage device.

[0049] According to the second storage device of the second aspect of the present application, a fourth storage device according to the second aspect of the present application is provided. Among them, the file system determines a second file name of the compressed file corresponding to the first file name of the file indicated to be operated on by the write file. Determines a second file system path of the compressed file according to the first file system path indicated by the write file. And generates a storage command according to the second file system path and the second file name. The storage command processing unit processes the storage command to store the first compressed file data in the LBA space of the storage device.

[0050] According to the fifth storage device of the second aspect of the present application, a sixth storage device according to the second aspect of the present application is provided. Among them, in response to the file system basic operation indicating reading a file, the file system determines the third file system path and the third file name corresponding to the file to be operated indicated by the read file; and determines the fourth file system path of the compressed file corresponding to the file to be operated indicated by the read file according to the third file system path; and determines the fourth file name of the compressed file corresponding to the file to be operated indicated by the read file according to the third file name; and generates a storage command according to the fourth file system path and the fourth file name; the storage command processing unit processes the storage command to read the second compressed file data corresponding to the file to be operated indicated by the read file from the LBA space of the storage device; and the file system performs a decompression operation on the second compressed file data to obtain the second file data of the file to be operated indicated by the read file.

[0051] According to the sixth storage device of the second aspect of the present application, a seventh storage device according to the second aspect of the present application is provided. Among them, the file system generates at least one first storage command according to the second file system path, and searches for at least one first LBA address recording the first compressed file data in the file system metadata based on the at least one first storage command; generates at least one second storage command to write the first compressed file data to the at least one first LBA address; or generates at least one third storage command according to the fourth file system path, and searches for at least one second LBA address recording the second compressed file data in the file system metadata based on the at least one third storage command; and generates at least one fourth storage command to read the second compressed file data from the at least one second LBA address.

[0052] According to the seventh storage device of the second aspect of the present application, an eighth storage device according to the second aspect of the present application is provided. Among them, in response to the file system basic operation for reading a file, the file system determines at least one LBA address corresponding to the file to be operated indicated by the read file; and generates a storage command according to each LBA address; the storage command processing unit processes the storage command corresponding to each LBA address to read each second data block corresponding to the file to be operated indicated by the read file from the LBA space of the storage device; the file system performs a decompression operation on each second data block to obtain each first data block corresponding to before the compression of each second data block; and sequentially combines each first data block to obtain the file to be operated indicated by the read file.

[0053] According to the third storage device of the second aspect of the present application, the eighth storage device according to the second aspect of the present application is provided, wherein the file system reads a file in response to the file system basic operation instruction, wherein the file reading instruction is to read partial file data in the file to be operated; and determines the range of the partial file data, determines the first data block corresponding to the partial file data according to the range; and determines the second data block corresponding thereto according to the determined first data block, and determines the LBA address corresponding to the second data block; and generates a storage command according to the LBA address corresponding to the second data block; the storage command processing unit processes the storage command to read the second data block from the LBA space of the storage device; the file system performs a decompression operation on the second data block to obtain the corresponding first data block, and obtains the partial file data according to the first data block.

[0054] According to the third aspect of the present application, the first storage device according to the third aspect of the present application is provided, 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 an FPGA device that carries a file system basic operation and follows the NVMe protocol, wherein the FPGA device does not have the function of a file system; the file system writes a file in response to the file system basic operation instruction, and the file system splits the file data of the file to be operated indicated by the write file into multiple third data blocks, and generates a storage command for each third data block according to the LBA address represented by the file pointer for each third data block; wherein, the size of each third data block is the same as the storage space size indicated by each LBA address; the storage command processing unit processes the storage command corresponding to each third data block, performs a compression operation on each third data block to obtain a compressed fourth data block; and sequentially stores the fourth data block corresponding to each third data block into the LBA space of the storage device.

[0055] According to the first storage device of the third aspect of the present application, the second storage device according to the third aspect of the present application is provided, wherein the storage command processing unit processes the storage command corresponding to the third data block, performs a compression operation on the third data block to obtain the corresponding compressed fourth data block, and compares the size of the fourth data block with the remaining storage space size corresponding to the LBA address represented by the file pointer of the third data block; determines the value of the LBA address carried in the storage command processing result corresponding to the third data block according to the comparison result.

[0056] According to the first storage device of the third aspect of the present application, a third storage device according to the third aspect of the present application is provided. Among them, in response to the file system basic operation being to read a file, the file system determines the LBA address corresponding to each third data block corresponding to the file to be operated indicated by the read file; and generates a storage command according to each LBA address; the storage command processing unit processes the storage command corresponding to each LBA address to read out the fourth data block corresponding to each third data block from the LBA space; and performs a decompression operation on each fourth data block to obtain the corresponding third data block; the file system splices each third data block in sequence to obtain the file to be operated indicated by the read file.

[0057] According to the fourth aspect of the present application, a data processing system according to the fourth aspect of the present application is provided, including an FPGA device and a storage device. 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 the file system basic operation and follows the NVMe protocol to the storage device; the storage device uses the file system to process the file system basic operation 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; among them, in response to the file system basic operation indicating to write a file, the storage device compresses the file to be operated indicated by the file system basic operation and stores the data corresponding to the compressed file in the LBA space of the storage device; or in response to the file system basic operation indicating to read a file, reads the data corresponding to the compressed file from the LBA space of the storage device, and decompresses the data to obtain the file to be operated indicated by the file system basic operation. Description of the Drawings

[0058] Figure 1A Block diagram showing a storage device;

[0059] Figure 1B Detailed block diagram showing the control component of the storage device;

[0060] Figure 2A Format of a custom command provided according to an embodiment of the present application;

[0061] Figure 2B Format of a custom command provided according to another embodiment of the present application;

[0062] Figure 2C Format of a custom command provided according to still another embodiment of the present application;

[0063] Figure 3A Format of a custom command provided according to another embodiment of the present application;

[0064] Figure 3B Represents the format of a custom command provided by another embodiment of the present application;

[0065] Figure 3C Represents the format of a custom command provided by another embodiment of the present application;

[0066] Figure 4 Represents a block diagram of a storage device that supports basic operations of a file system provided by an embodiment of the present application;

[0067] Figure 5 Represents a schematic diagram of an FPGA device accessing a storage device through a custom command provided by an embodiment of the present application;

[0068] Figure 6 Represents a schematic diagram of a host accessing a storage device through an IO command provided by an embodiment of the present application;

[0069] Figure 7 Represents a block diagram of a storage device provided by another embodiment of the present application;

[0070] Figure 8 Represents a block diagram of a storage device provided by another embodiment of the present application;

[0071] Figure 9 Shows a schematic structural diagram of a control component provided by an embodiment of the present application;

[0072] Figure 10A Shows a schematic structural diagram of a control component provided by another embodiment of the present application;

[0073] Figure 10B Shows a schematic structural diagram of a control component provided by another embodiment of the present application;

[0074] Figure 10C Shows a schematic structural diagram of a control component provided by another embodiment of the present application;

[0075] Figure 11A Shows a schematic structural diagram of a control component provided by another embodiment of the present application;

[0076] Figure 11B Shows a schematic diagram of storing files in the LBA space provided by an embodiment of the present application;

[0077] Figure 11C Shows a schematic structural diagram of a control component provided by another embodiment of the present application;

[0078] Figure 11D Shows a schematic structural diagram of a control component provided by another embodiment of the present application.

[0079] Related technical terms

[0080] 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;

[0081] Custom commands: Commands that conform to the storage protocol definition in terms of command form or format and carry basic operations of the file system;

[0082] File system: An executable program that provides file system functions, or a hardware unit that implements file system functions;

[0083] 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;

[0084] File system path: Describes the path of a directory / file in the hierarchical directory structure of the file system.

[0085] OP: Indicates the operation type corresponding to the basic operation of the file system;

[0086] FILEOBJ: Indicates the file parameter corresponding to the basic operation of the file system;

[0087] 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 (e.g., 4K) host memory or FPGA device memory;

[0088] File system metadata: Used to describe the logical address of the file data managed by the file system in the LBA space;

[0089] inode: A data structure that constitutes file system metadata. File system metadata includes multiple inodes, each of which can have a specific size and is recorded in the logical address space of the storage device. Specific embodiments

[0090] 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 some, rather than all, of the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0091] 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 providing 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 files by sending a custom command carrying basic file system operations 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.

[0092] 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 files 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 basic file system operations, and the specific information indicated by the command content is different based on the different command types (operation types of basic file system operations). By using custom commands (carrying basic file system operations) to interact between the FPGA device and the storage device, the storage device can process basic file system operations by processing the custom commands, and the FPGA device can access the storage device in the manner of a file system.

[0093] Among them, the basic file system operations include, for example, the following operations:

[0094] 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;

[0095] 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;

[0096] fread(file_path_name, buf) indicates to read out file data, where file_path_name represents the file system path and file name of the file to be operated, and buf represents the memory buffer for accommodating the read-out data;

[0097] fdelect(file_path_name) indicates to delete file data, where file_path_name represents the file system path and file name of the file to be operated;

[0098] 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 to be operated on, attribute represents the name of the attribute to be modified, and value represents the new value of the attribute;

[0099] flist(file_path) indicates listing all files and directories under the specified file system path, and file_path represents the specified file system path;

[0100] 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.;

[0101] format indicates formatting the file system;

[0102] fmnt indicates mounting and unmounting the file system;

[0103] fdisk indicates partition creation and management operations, such as creating partitions, deleting partitions, viewing partitions, etc.

[0104] Correspondingly, the FPGA device in 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 mode.

[0105] 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 file system in software form in the host, so that the file system in software form 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.

[0106] The host accesses the file data written by the FPGA device to the storage device in the file system mode, so that the host generates NVMe IO commands in the existing technical solution (for example, through the software form file system and NVMe driver running on the host) to access the files written by the FPGA device in the storage device. When the 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 in the file system mode of the existing technology without modifying the host.

[0107] 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 that the FPGA device can access the storage device in a file system manner. 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 an IO command between the file system and the storage device, so that the host can identify and access the file data written by the FPGA device to the storage device without modifying the host.

[0108] The following introduces the custom commands for interaction between the FPGA device and the storage device. The basic file system operations are encapsulated in a custom command that complies with, for example, the NVMe protocol. According to the custom command of the embodiments of the present application, it includes at least a field for accommodating the OP, a field for accommodating the PRPList, and an optional field for accommodating the FILEOBJ.

[0109] 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 the OP, indicating the operation type of the basic file system operation, which can indicate fopen, fwrite, fread, flist, etc.; the 11th DWORD is the 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 the PRPList, indicating the host or FPGA device memory space corresponding to data and buf.

[0110] Since the string length of the file_path_name indicated by the FILEOBJ is uncertain and may exceed the size of the custom command, and the sizes of data / buf change with the data size of reading and writing files and often exceed the size of the custom command, 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, data / buf with variable lengths / forms / quantities of the basic file system operations.

[0111] Figure 2A Shows the format of the custom command provided by an embodiment of the present application.

[0112] As an example, see Figure 2A, the custom commands carrying the basic operations of the file system include 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 PRPList is carried in the custom commands of the embodiments of the present application in the same format as the NVMe IO command in the NVMe protocol carrying the PRPList.

[0113] 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.

[0114] In Figure 2A the embodiments, the PRPList includes, for example, 1 or 2 PRP entries, which are completely accommodated in the custom command. When the PRPList includes, for example, more PRP entries, these PRP entries cannot be accommodated by the custom command due to the excessive number, so the Figure 2A custom command format shown cannot be used.

[0115] Figure 2B shows the format of the custom command provided by another embodiment of the present application.

[0116] As an example, referring to Figure 2B , the custom commands carrying the basic operations of the file system include 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 commands of the embodiments of the present application in the same format as the NVMe IO command in the NVMe protocol carrying the PRPList.

[0117] In Figure 2B In the custom command shown, there is no field directly accommodating FILEOBJ, but rather a field accommodating FILEOBJ ptr. FILEOBJ ptr indicates the FILEOBJ index (such as a 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 size (64 bits).

[0118] As an example, in the custom command indicating fdelect(file_path_name), where file_path_name is " / root / bin / foo.txt" and its size exceeds 64 bits. Since FILEOBJ exceeds 64 bits, it cannot be directly accommodated by 1 DWORD in the custom command. The embodiments of the present application adopt Figure 2B the custom command format shown. In the custom command, FILEOBJ is not directly accommodated, but rather the FILEOBJ index is recorded by setting a field of FILEOBJ ptr in the custom command, and then the FILEOBJ is indexed to the specified memory space through the FILEOBJ index, and FILEOBJ is recorded in the specified memory space. For example, the size of the specified memory space is 4KB, which is sufficient to accommodate " / root / bin / foo.txt".

[0119] Figure 2C Shows the format of the custom command provided by another embodiment of the present application.

[0120] As an example, referring to Figure 2C , the custom command carrying the basic operations of the file system does not have a field directly accommodating FILEOBJ, and only includes a field accommodating OP and a field accommodating PRPList. The field accommodating OP is, for example, 10 bits in size, and the field accommodating PRPList is, for example, 1 or several DWORD sizes. As an example, in the custom command 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 accommodating PRPList. The field accommodating PRPList records the index of the first PRP entry of PRPList, which is used to index the first PRP entry of PRPList (such as PRP0), and through the first PRP entry of PRPList, it is indexed to its corresponding specified-size memory space (such as 4KB), in which FILEOBJ is recorded, and thus FILEOBJ is found.

[0121] For example, for fileopen(" / root / bin / foo.txt”), the length of the file path far exceeds 64 bits, and FILEOBJ exceeds 64 bits. Since FILEOBJ exceeds 64 bits, it cannot be directly accommodated by 1 DWORD in the custom command. The embodiments of the present application adopt Figure 2C the custom command format shown. Instead of directly accommodating FILEOBJ in the custom command, FILEOBJ is recorded in the memory space corresponding to the first PRP entry. By accommodating the field of PRPList in the custom command to record the index of the first PRP entry of PRPList, the first PRP entry can be indexed through the index of the first PRP entry, and then the corresponding memory space can be 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”.

[0122] For another 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 are too numerous to be accommodated by the custom command. The embodiments of the present application adopt Figure 2C the custom command format shown. The field that accommodates PRPList in the custom command does not directly accommodate the PRP entries corresponding to PRPList itself, but records the index of the first PRP entry of PRPList. The indexes of other PRP entries in PRPList are determined through the index of the first PRP entry, and the corresponding PRP entries are indexed according to the indexes of each PRP entry. For example, the index of the second PRP entry of PRPList = the index of the first PRP entry of PRPList + 1, and so on to obtain the indexes of other PRP entries in PRPList. Data and buf are recorded in the memory spaces indicated by other PRP entries (except the first PRP entry) in PRPList. As Figure 2CThe custom command format shown can support the case where the PRPList includes more PRP entries. For the several custom command formats mentioned above, both the FPGA device and the storage device can accept them. For custom commands in different formats, the storage device parses them in different ways. 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 uses, a flag field is also carried in the custom command, and the flag field is used to indicate which format the custom command uses. The storage device identifies the corresponding format based on the content recorded in the flag field and then identifies 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.

[0123] Figure 4 shows a block diagram of a storage device that supports basic operations of a file system according to an embodiment of the present application.

[0124] As an example, the storage device includes a control component, as Figure 4 shown, the control component includes a host interface, a host command processing unit, a file system (implemented in software or hardware form), 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.

[0125] The storage device is coupled to the FPGA device, and the host command processing unit receives a custom command carrying basic operations of the file system sent by the FPGA device through the host interface. After receiving the custom command carrying 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.

[0126] The file system generates one or more storage commands according to the type of basic file system operations and file parameters, and provides the generated storage commands to the storage command processing unit. When the control component processes a custom command carrying basic file system operations provided by the FPGA device, the file system provides the storage command to the storage command processing unit, rather than as Figure 1B shown, where the host command processing unit provides the storage command to the storage command processing unit. The storage command provided by the file system to the storage command processing unit is the same as the format or information carried by the storage command sent by the host command processing unit to the storage command processing unit when the control component processes the NVMe command sent by the host.

[0127] The storage command processing unit processes the storage commands. The storage medium management unit maintains the conversion of logical addresses to physical addresses for each storage command. The storage command processing unit generates a media interface command according to the physical address provided by the storage medium management unit, and operates the media interface controller through the media interface command to issue a storage medium access command to the NVM chip. It should be understood that when the control component processes a custom command carrying basic file system operations sent by the FPGA device, the processing processes of the storage command processing unit, the storage medium management unit, and the media interface controller in the control component are similar to those when processing the NVMe command sent by the host.

[0128] The storage device is coupled to the host. For the process of the control component in the storage device processing the NVMe command sent by the host, refer to Figure 1B which will not be elaborated here.

[0129] For the 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 position (logical address) of the file data managed by the file system in the LBA space. Different file systems have different formats, meanings, and recording positions for their file system metadata. For example, for the FAT file system, the file system metadata is the FAT table, located at the start and end positions of the LBA space; for the XFS file system, the file system metadata includes the superblock, inode (i-node), free space information, etc., located at the start position of the LBA space. And for different file systems, the organization method / data structure of their file system data is the same.

[0130] The process of the FPGA device accessing the storage device based on a custom command will be introduced below.

[0131] Figure 5 shows a schematic diagram of the FPGA device accessing the storage device through a custom command provided by an embodiment of the present application.

[0132] InFigure 5 The middle file system metadata is located at the start position of the LBA space. See Figure 5 , after the FPGA device generates a custom command carrying the basic operations of the file system, the custom command is sent 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 the basic operations of the file system (such as the content based on OP), the basic operations of the file system carried by the custom command are forwarded to the file system. In response to receiving the basic operations of the file system, the file system generates one or more storage commands according to the type of the basic operations of the file system and the file parameters to process the basic operations of the file system, 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.

[0133] As an example, the custom command sent by the FPGA device carries fread(file_path_name, buf), which indicates a read file 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 out the inode (denoted as inode_D) that records the directories at all levels under the file system path indicated by file_path_name in the file system metadata.

[0134] 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 address 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.

[0135] 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 yet another storage command, and the LBA address of the storage location of the file data itself representing the file “abc.txt” 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 records for the LBA addresses of the storage locations of the file data itself representing the file “abc.txt”.

[0136] Still by way of example, the fwrite(file_path_name, data) carried in 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. Also, data is 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.

[0137] 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 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 media access command is generated and sent to the corresponding logical unit to write the file data to the corresponding physical page.

[0138] The control component generates a completion message in response to the completion of the processing of the custom command indicating the fwrite(file_Path_name, data) operation and sends it to the FPGA device.

[0139] For another example, for fread(file_path_name, buf), the storage command processing unit determines the physical address (PPA) corresponding to the LBA carried by 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 by 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.

[0140] 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.

[0141] 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 a 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, based on which all files and directories under the file system path “ / root / Directory1” are enumerated.

[0142] 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 will not be elaborated one by one here.

[0143] According to the embodiments of the present application, the FPGA device sends custom commands carrying basic file system operations to the storage device, forming a directory structure and the written files in the LBA space of the storage device. For example, the FPGA device successively sends custom commands to the storage device, which carry fwrite(“ / root / bin / foo.s”, “aabbccdd”), fwrite(“ / root / dev / abc.txt”, “hello”), fwrite(“ / root / bar.dat”, “……”). After the storage device processes these custom commands, the following file system data structure is formed in the logical address space of the storage device:

[0144] / root

[0145] / bin / foo.s

[0146] / dev / abc.txt

[0147] bar.dat

[0148] 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.

[0149] Therefore, the FPGA device does not need to include a file system and can also write a file located in a specified file system path to a storage device in a file manner. Moreover, the file data written by the FPGA device according to the embodiments of the present application can be recognized by a host including a file system in the prior art without modifying the host.

[0150] After the FPGA device writes file data to the storage device based on a custom command, the host can access the file data written by the FPGA device through the file system. The following introduces the process of the host accessing the file data written by the FPGA device through the file system.

[0151] Figure 6 This is a schematic diagram of the host accessing a storage device through an IO command provided by the embodiments of the present application.

[0152] See Figure 6 , the host includes a file system, an application program, and an NVMe driver (not labeled in Figure 6 ). It should be understood that the file system in the host is different from the file system in the control component shown above in Figure 5 . The file system in the host includes file system metadata.

[0153] The application program running in the host issues a basic file system operation to the file system running in the host to read file data. The file system of the host issues one or more NVMe read commands to the storage device through, for example, the NVMe driver according to the received basic file system operation. 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.

[0154] For the host, it generates basic file system operations by running application programs. The host's file system determines the LBA where the file data to be operated is stored based on the file system path (file_path_name) of the file being operated in the basic file system operations and the file system metadata. The file system sends the LBA to, for example, the 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 via the NVMe command and also access the file data stored in the LBA space of the storage device.

[0155] As an example, the basic file system operation is a file read operation indicated by fread(“ / root / bar.dat”, buf). The host's file system 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, 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 the 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 by 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.

[0156] As an example, the specific application scenario of the embodiments of the present application includes a first stage in which the FPGA device writes file data and a second stage in which the host reads the file data written by the FPGA device. The first stage occurs at the data acquisition site, where the FPGA device writes the collected data to 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, for example, fields, ships, spacecraft, factories, etc., to write the collected on-site data to the storage device in the form of files in a high-speed and low-power manner. The second stage occurs, for example, in 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.

[0157] 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 to the storage device in the way of file operation. The process of the FPGA device writing file data to the storage device can refer 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.

[0158] 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 to 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 way.

[0159] Figure 7 It is a block diagram of the storage device provided by another embodiment of the present application.

[0160] As an example, referring to Figure 7 , the control component of the storage device includes 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 an NVMe command (NVMe read or NVMe write command) 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 the NVMe command, the storage device is processed by control circuit 701, and for the custom command, control circuit 701 and control circuit 702 need to cooperate to process it. 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.

[0161] 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 media access command and sends it to the corresponding logical unit.

[0162] 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 the corresponding multiple storage commands to the storage command processing unit. The process of the storage command processing unit processing the storage commands is as described above and will not be elaborated here.

[0163] Figure 8 It is a block diagram of a storage device provided by another embodiment of the present application.

[0164] 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 a PCIe link. For example, when a user wants to access data in the NVM chip, an NVMe read command or an NVMe write command is generated by the host, and the NVMe read command or the NVMe write command is sent 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 media 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.

[0165] Continue to refer to Figure 8, for example, CPU group 1 includes four CPU cores: 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 implementing the host command processing unit, the storage command processing unit, and the storage medium management unit may not depend on the operating system.

[0166] As an example, Figure 8 As shown, CPU group 2 includes four CPU cores: 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) and applications, file systems, etc. are set up on the standard operating system. The host (FPGA device) communicates with the control circuit 802 in the control component through, for example, SSH.

[0167] 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.

[0168] Still as an example, when the host communicates with the operating system / application in control circuit 802, it can communicate through the PCIe link between control component 801 and the host. For example, the host sends communication or call requests to control circuit 802 through custom commands that comply with the NVMe protocol. Control circuit 801 forwards such communication or call requests to control circuit 802, and the corresponding responses made by control circuit 802 are also returned to the host through control circuit 801 as responses to the custom commands.

[0169] 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 and written 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.

[0170] 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.

[0171] 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 of 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 medium 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.

[0172] 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 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 regarding 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.

[0173] The sizes of the files written to the storage device in a file system manner range from several KB to several GB. Since the storage capacity of the storage device is limited, in order to reduce the storage space occupied by the files, according to some embodiments of this application, the storage device compresses the files to be written to the storage device and stores the compressed file data in the storage device.

[0174] Figure 9 The structural schematic diagram of the control component provided by the embodiment of this application is shown.

[0175] As an example, as Figure 9 shown, the host command processing unit in the control component receives the custom command VU1 through the host interface. In response to recognizing that the custom command VU1 carries the basic file system operation fwrite(file_path_name, data) of writing a file, the host command processing unit forwards the file writing operation indicated by the custom command VU1 to the file system. In response to receiving the file writing operation, the file system caches the file data (data) indicated by the file writing operation and determines the file name of the compressed file corresponding to the file name indicated by the file writing operation. In one or more embodiments, in Figure 9 the control component shown, the file system includes a file cache A1; the file cache A1 is used to cache the file data (data) indicated by the file writing operation. In yet one or more embodiments, the file system further includes a mapping table; the mapping table is used to cache the mapping relationship between the file name indicated by the file writing operation carried by the custom command VU1 and the file name of the compressed file. For example, the file system determines the file name filename1 of the file to be operated according to the file system path and file name file_path_name of the file indicated in the file writing operation, determines the compressed file name filename1_C according to the file name filename1, and allocates an entry in the mapping table to record the mapping relationship between <filename1, filename1_C>. In yet one or more embodiments, the file system does not include a mapping table, and the file system obtains filename1_C by calling the hash function Hash() and performing a hash operation on filename1 according to the hash function Hash(), such as filename_C = Hash(filename).

[0176] After all the file data to be operated on corresponding to the write file operation indicated by the custom command VU1 is stored in the file cache A1, the file system performs a compression operation on the file data to be operated on corresponding to the write file operation indicated by the custom command VU1 to obtain a compressed file. For example, the file system compresses the file using compression algorithms such as ZIP and RAR. It should be understood that any algorithm capable of compressing file data is applicable to the file system of the embodiments of the present application, and no limitation is made here. Additionally, for example, if the compressed file data is data_C, it should be understood that the size of the compressed file data_C will be smaller than the size of the file data (data) to be operated on corresponding to the write file operation indicated by the custom command VU1.

[0177] After the file system performs a compression operation on the file data (data) to be operated on corresponding to the write file operation indicated by the custom command VU1 to obtain the compressed file data (data_C), it also determines the file system path of the compressed file. For each directory in the file system path, the mapped directory name is obtained respectively, and the mapped directory name and file name are used to obtain the file system path and file name (denoted as file_path_name_C) for the compressed file after mapping. For example, if the file_path_name obtained from the VUI is " / root / filename1_C", the mapped file_path_name_C is " / root_C / filename1_C". Among them, the mapped directory name is obtained from the directory name through a mapping table or by using a hash function.

[0178] Next, the file system writes the compressed file data using the mapped file system path and file name for the compressed file, i.e., it executes fwrite(" / root_C / filename1_C", data_C). The process of the file system in the control component executing fwrite(" / root_C / filename1_C", data_C) has been described in the previous embodiments of this application. For example, for fwrite(" / root_C / filename1_C", data_C), the file system reads the inode (inode_D) representing the root directory " / " 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_C" is obtained from this inode. Subsequently, the inode (inode_D) representing the directory "root_C" is read through another storage command, and the LBA address of the inode (inode_F) representing the file "filename1_C" is obtained from this inode. Next, the inode (inode_F) representing the file "filename1_C" is read through yet another storage command, and the LBA address of the storage location of the file data itself of the file "filename1_C" is obtained from this inode; then the file data data_C of "filename1_C" is written to the corresponding LBA space through a storage command indicating the LBA address of the storage location of the file data itself of the file "filename1_C". When necessary, additional storage space is also allocated from the LBA space to accommodate part or all of the file data data_C, and the LBA address of the allocated storage space is recorded in the inode (inode_F) representing the file "filename1_C".

[0179] Continue to refer to Figure 9 , the file system metadata corresponding to the compressed file and the compressed file are recorded in the LBA space of the storage device.

[0180] As another example, such as Figure 9As shown, the host command processing unit in the control component receives the custom command VU2. In response to recognizing that the custom command VU2 indicates the file system basic operation fread(file_path_name, buf) for reading a file, the host command processing unit sends the read file operation fread(file_path_name, buf) indicated by the custom command VU2 to the file system. In response to receiving the read file operation, the file system determines the compressed file name corresponding to the file to be operated on indicated by the read file operation. For example, the file system determines the directory name and file name filename2 of the location where the file to be operated on is located based on the file system path and file name file_path_name of the file to be operated on indicated in the write file operation, and determines the file system path file_path_name_C composed of the directory name and file name of the compressed file corresponding to file_path_name according to the mapping relationship corresponding to the file system basic operation recorded in the mapping table. Another example is that the file system calls the hash function Hash(), and performs a hash operation on the directory name and file name according to the hash function Hash() to obtain the file system path file_path_name_C composed of the directory name and file name of the compressed file.

[0181] The file system issues one or more storage commands according to file_path_name_C to find and read inode (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_C. After obtaining inode_D that records the directory where the file to be read indicated by file_path_name_C is located, one or more inodes (denoted as inode_F) that record the file to be read indicated by file_path_name_C 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 of the files stored in the LBA space based on inode_F and generates one or more storage commands to read the compressed files stored in the storage device. For example, for fread(“ / root_C / filename2_C”, 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_C” is obtained from this inode. Subsequently, the inode (inode_D) representing the directory “root_C” is read through another storage command, and the LBA address of the inode (inode_F) representing the file “filename2_C” is obtained from this inode. Next, the inode (inode_F) representing the file “filename2_C” is read through another storage command, and the LBA address of the storage location of the file data itself representing the file “filename2_C” is obtained from this inode; then, the compressed file “filename2_C” is read through a further storage command.

[0182] The file system caches the compressed file read from the storage device into, for example, file cache A1. In response to the complete reading of the compressed file, a decompression operation is performed on the compressed file to obtain the pre-compressed file. Among them, the file of the pre-compressed file is the non-compressed form of the file that the read file operation indicates to read, such as the file corresponding to filename2. The pre-compressed file is sent to the host or FPGA device.

[0183] For the write file operation, the file system can cache the entire file corresponding to the write file operation into file cache A1 and then perform compression on the entire file corresponding to the write file operation to obtain the compressed file. The file system can also compress some data (rather than the whole) in the file corresponding to the write file operation. See Figure 10A as shown.

[0184] Figure 10AThe structural schematic diagram of the control component provided by another embodiment of the present application is shown.

[0185] For example, as Figure 10A shown, when the host command processing unit in the control component receives the custom command VU3, and the host command processing unit responds to identifying that the custom command VU3 indicates the basic file system operation fwrite(file_path_name, data) of writing a file, it forwards the write file operation indicated by the custom command VU3 to the file system. In response to receiving the write file operation, the file system divides the file data data indicated by the write file operation into multiple data blocks of a specified size (for example, 16KB or 8KB). For example, the file data data indicated by the write file operation is divided into 3 data blocks in sequence, namely data block 1, data block 2, and data block 3. The file system then compresses each data block respectively to obtain the compressed data blocks. For example, compressed data block 1', compressed data block 2', and compressed data block 3'. The file system allocates one or more LBA addresses for each compressed data block according to the size of each compressed data block. The sizes of the compressed data blocks can be different, which is related to the content of the data blocks. For example, each LBA indicates a size of 4KB, and if the size of compressed data block 1' is 5KB, then two LBA addresses are allocated for compressed data block 1'; if the size of compressed data block 2' is 2KB, then one LBA address is allocated for compressed data block 2'; if the size of compressed data block 3' is 1KB, then one LBA address is allocated for compressed data block 3'. And compressed data block 2' and compressed data block 3’ are allocated the same LBA address. Then, the file system generates one or more storage commands according to the LBA addresses allocated for each data block, and records the mapping relationship between the file name, each compressed data block, and the LBA addresses allocated for each compressed data block. For example, if consecutive LBA addresses are allocated for each compressed data block, in this mapping relationship, record the file name, the starting LBA address, and the length, denoted as <fliename, LBA, Length>, where, fliename represents the file name, LBA represents the starting LBA address, and Length represents the length. Another example, if the LBA addresses allocated for each compressed data block are not consecutive, record the file name and the LBA addresses allocated for each compressed data block in this mapping relationship, denoted as <fliename, LBA>, where, LBA represents the LBA addresses allocated for each compressed data block. The mapping relationship between the file name, each compressed data block, and the LBA addresses allocated for each compressed data block can be recorded in a linked list or an iNode-based data structure.

[0186] The storage command processing unit in the control component processes the storage commands received from the file system, and stores the compressed data blocks corresponding to the storage commands into the corresponding LBA space. For the process of the storage command processing unit handling the storage commands, refer to Figure 1B , which will not be elaborated here.

[0187] Figure 10B Fig. shows the structural schematic diagram of the control component provided by another embodiment of the present application.

[0188] As an example, as Figure 10B shown, the host command processing unit in the control component receives the custom command VU4. In response to recognizing that the custom command VU4 indicates the file system basic operation fread(file_path_name, buf) for reading a file, the host command processing unit sends the read file operation fread(file_path_name, buf) indicated by the custom command VU4 to the file system. In response to receiving the read file operation, the file system determines the LBA addresses of the compressed data blocks (such as compressed data block 1', compressed data block 2', and compressed data block 3') corresponding to the file name indicated by the read file operation according to the mapping relationship between the recorded file name and the LBA addresses assigned to the compressed data blocks. The file system generates a storage command based on the LBA addresses and sends the generated storage command to the storage command processing unit. The storage command processing unit processes the storage command to read the compressed data blocks from the storage device. The file system decompresses the compressed data blocks to obtain the data blocks (such as data block 1, data block 2, and data block 3) corresponding to the file to be operated indicated by the read file operation, determines the file data to be read by the read file operation according to the data blocks corresponding to the file to be operated indicated by the read file operation, and sends the file data as a response to the custom command VU4 to, for example, a host or an FPGA device, etc.

[0189] In some scenarios, when reading a file, only a part of the file data needs to be read. For example, the file size is 100KB, and the part of the file data from 51KB to 60KB in the file needs to be read. In the case of compressing the entire file data (for example, in combination with the Figure 9 described implementation manner), in order to read the file data in the range of 51KB - 60KB in the file, it is necessary to read out all the file data of the file and decompress it, and then extract the part of the file data from 51KB to 60KB from the decompressed file data. Reading out all the file data of the file not only occupies bandwidth but also increases the processing resource burden.

[0190] According to the present application Figure 10A , 10B, In the embodiment of 10C, when the file system processes the operation of writing a file, the file is divided into multiple data blocks, and each data block is compressed and stored. When reading a file, not only can all the data corresponding to the file be read (as shown in Figure 10B ), but also only a part of the file data in the file can be read, as shown in Figure 10C .

[0191] Figure 10C FIG. shows a schematic structural diagram of a control component provided by another embodiment of the present application.

[0192] As an example, as shown in Figure 10C , when the host command processing unit in the control component receives the custom command VU5, the host command processing unit responds to identifying that the custom command VU5 indicates the basic file system operation fread(file_path_name, buf, offset, length) for reading a file; where offset indicates the offset of the file data to be read in the entire file, and length indicates the length of the file data to be read. The read file operation fread(file_path_name, buf, offset, length) indicated by the custom command VU5 is sent to the file system. In response to receiving the read file operation, the file system determines the range of the file data to be read according to the offset offset and the length length. For example, the file size is 50KB, and the custom command VU5 indicates that the range of the file data to be read is 20KB - 30KB. When the file is written, the file data has been divided into data blocks, for example, according to a size of 16KB. A 50KB file is divided into 4 data blocks, namely data block 1 (0 - 15KB), data block 2 (16KB - 31KB), data block 3 (32KB - 47KB), and data block 4 (48KB - 49KB). Then, the range of the file data to be read, 20KB - 30KB, is located in data block 2. The file system compresses data block 2 to obtain the compressed data block 2', where the size of the compressed data block 2' is 3KB, and the LBA address assigned by the file system to the compressed data block 2' is LBA1. The file system determines that it belongs to data block 2 according to the range of the file data to be read, determines the compressed data block 2' according to data block 2, and determines LBA1 according to the compressed data block 2'. Then, the file system generates a storage command according to LBA1 and sends the storage command to the storage command processing unit. The storage command processing unit processes the storage command and reads out the compressed data block 2' corresponding to the LBA1 address. The file system decompresses the compressed data block 2' to obtain the corresponding data block 2, and extracts the data within the corresponding file data range of 20KB - 30KB from the data block 2 as the execution result of VU5 and sends it to a device coupled to the storage device, such as a host or an FPGA.

[0193] In one or more embodiments, the compression operation and decompression of files can be performed not only by the file system in the control component, but also by other modules in the control component, such as the storage command processing unit in the control component.

[0194] Figure 11A Show a schematic structural diagram of the control component provided by another embodiment of the present application.

[0195] For example, as Figure 11A shown, the host command processing unit in the control component receives the custom command VU6. In response to recognizing that the custom command VU6 indicates the file system basic operation fwrite(file_path_name, data) for writing a file, the host command processing unit forwards the write file operation indicated by the custom command VU6 to the file system. In response to receiving the write file operation, the file system divides the file data indicated by the write file operation into multiple data blocks, for example, according to the data size that each storage command can write. The size of the divided data blocks is the same as the data size that each storage command can write. For example, if the data size that each storage command can write is 4KB, then the size of each divided data block is also 4KB.

[0196] The file system sequentially writes each data block into the LBA space through multiple storage commands. The file system maintains a file pointer (file_pointer). The file pointer represents the LBA address allocated for the data block. As a data block is written into the LBA space through a storage command, the new value of the file pointer is carried in the processing result of the storage command, and the file system generates a new storage command with the new value of the file pointer to write the next data block into the LBA space. Until all data is written into the LBA space through storage commands. And the file system also records the new value of the file pointer carried in the processing result of each storage command in, for example, the iNode.

[0197] When processing the storage command, the storage command processing unit performs a compression operation on each data block and stores the compressed data block in the LBA space of the storage device.

[0198] Since the size of the data block before compression is the same as the size indicated by the LBA, and the size of the data block after compression is smaller than that before compression, which makes the size of the data block after compression smaller than the storage space size indicated by an LBA address. An LBA address can store one or more data blocks after compression. Therefore, the LBA address provided by the file system to the storage command through the file pointer may be different from the LBA address written when the storage command processing unit processes the storage command. The storage command processing unit notifies the file system of this difference through the processing result of the storage command.

[0199] When processing a storage command, the storage command processing unit determines the LBA address indicated by the current storage command, compresses the data to be written by the current storage command to obtain the compressed data, and determines whether the storage space corresponding to the current LBA address can accommodate the compressed data.

[0200] If the remaining capacity of the storage space corresponding to the current LBA address can accommodate the compressed data of the current storage command and there is still remaining space after accommodating the compressed data, the storage command processing unit caches the compressed data and uses the current LBA address as the new value of the file pointer carried in the processing result of the current storage command.

[0201] If the remaining capacity of the storage space corresponding to the current LBA address can only accommodate the compressed data of the current storage command and there is no remaining space, the storage command processing unit writes the compressed data from one or more storage commands cached into the storage command corresponding to the current LBA address, increments the current LBA address (e.g., by 1), and uses the incremented LBA address as the new value of the file pointer carried in the processing result of the current storage command.

[0202] If the remaining capacity of the storage space corresponding to the current LBA address cannot accommodate the compressed data of the current storage command, the storage command processing unit writes the compressed data from one or more storage commands (excluding the current storage command) cached into the storage command corresponding to the current LBA address, caches the compressed data of the current storage command, increments the current LBA address (e.g., by 1), and uses the incremented LBA address as the new value of the file pointer carried in the processing result of the current storage command.

[0203] For example, the file system divides the file data of the file indicated by the custom command VU6 into 5 data blocks, namely data block DU1, data block DU2, data block DU3, data block DU4, and data block DU5. When processing data block DU1, the file system generates a storage command 1 according to the file pointer indicating LBA1, which instructs to write data block DU1 to the LBA address (LBA1) represented by the file pointer. The storage command processing unit receives storage command 1, compresses the data block DU1 corresponding to storage command 1 to obtain a compressed data block cDU1. The current LBA is LBA1, and the storage command processing unit maintains the remaining storage space corresponding to the current LBA1. The storage command processing unit judges the size relationship between the compressed data block cDU1 and the remaining storage space corresponding to LBA1, and determines the returned LBA address according to the size relationship.

[0204] For example, if the size of the compressed data block cDU1 is smaller than the remaining storage space corresponding to the current LBA1, the storage command processing unit updates the size of the remaining storage space corresponding to the currently maintained LBA1. For example, it updates the size of the remaining storage space corresponding to the currently maintained LBA1 according to the difference between the remaining storage space corresponding to the currently maintained LBA1 and the size of cDU1. In addition, the LBA address returned by the storage command processing unit to the file system through the processing result of the storage command is LBA1. It should be understood that in this scenario, the compressed data block cDU1 will be stored in the storage space corresponding to LBA1. Optionally, since the remaining storage space corresponding to the currently maintained LBA1 has not been exhausted, the compressed data block cDU1 is temporarily cached by the storage command processing unit and not written to the NVM chip.

[0205] Another example is that if the size of the compressed data block cDU1 is equal to the remaining storage space corresponding to the current LBA1, the LBA address returned by the storage command processing unit to the file system is LBA1 + 1. It should be understood that in this scenario, the compressed data block cDU1 is stored in the storage space corresponding to LBA1. Since the remaining storage space corresponding to the currently maintained LBA1 has been exhausted, the compressed data block cDU1 (together with the data to be written to LBA1 cached previously) is written to the NVM chip by the storage command processing unit.

[0206] For another example, if the size of the compressed data block cDU1 is larger than the remaining storage space corresponding to the current LBA1, the storage command processing unit writes the data to be written to LBA1 previously cached into the NVM chip, increments the current LBA address by 1 (LBA1 + 1), and the storage command processing unit uses LBA1 + 1 as the currently maintained and managed LBA address. The storage command processing unit updates the size of the remaining storage space corresponding to LBA1 + 1 currently maintained. For example, it updates the size of the remaining storage space corresponding to LBA1 + 1 currently maintained according to the difference between the storage space corresponding to an LBA address and the size of cDU1. Additionally, the LBA address returned by the storage command processing unit to the file system is LBA1 + 1. It should be understood that in this scenario, the compressed data block cDU1 will be stored in the storage space corresponding to LBA1 + 1.

[0207] Thus, since the storage command processing unit compresses the data block, the LBA address returned by the storage command processing unit received by the file system may be the same as or different from the LBA address indicated by the file pointer provided by the file system for the data block to be stored. However, based on the LBA address indicated in the return result of each storage command generated by it, the file system can know which LBA addresses the data blocks of the entire file are sequentially written to. Thus, all the compressed data blocks are sequentially read from these LBA addresses and decompressed respectively to obtain the entire file written.

[0208] Optionally, after processing the storage command, in the processing result of the storage command provided by the storage command processing unit to the file system, in addition to indicating the LBA address (the new value of the file pointer) that the next storage command of the file system can use, it also indicates the LBA address actually written by the current storage command, so that the file system can know the LBA address to which the data block written by the current storage command is written.

[0209] Still by way of example, the file system receives the LBA address returned by the storage command processing unit for processing the data block DU1 as LBA1. The file system uses the LBA1 returned by the previous storage command to generate a storage command for the data block DU2. The storage command processing unit receives the storage command 2, parses the storage command 2 to obtain the LBA1 indicated by the storage command, and compresses the data block DU2 corresponding to the storage command 2 to obtain the compressed data block cDU2. The storage command processing unit maintains the remaining storage space corresponding to the current LBA1. The storage command processing unit determines the size relationship between the compressed data block cDU2 and the remaining storage space corresponding to LBA1, and determines the LBA address to be returned again according to the size relationship. The process by which the storage command processing unit determines the LBA address to be returned again according to the size relationship between the compressed data block cDU2 and the remaining storage space corresponding to LBA1 is similar to the process of determining the returned LBA address according to the size relationship between the compressed data block cDU1 and the remaining storage space corresponding to LBA1 described above.

[0210] And so on, the file system generates a storage command for the next data block DU3 according to the LBA address returned by the storage command processing unit for processing the compressed data block cDU2. Until the data corresponding to the file indicated by the custom command VU6 is written into the LBA space of the storage device. As an optional embodiment, there may be more than one write file operation processed by the control component. The file system in the control component processes the next write file operation according to the LBA address returned by the storage command processing unit for processing the compressed data block cDU5.

[0211] Still optionally, the file system records the file name, each data block corresponding to the file, and the LBA address corresponding to each data block in an associated manner, such as expressed as <fliename, <DU, LBA>>; where the LBA address corresponding to each data block is the LBA address corresponding to the compressed data block corresponding to each data block, or the value of the file pointer used when processing the data block by the storage command.

[0212] For example, such as Figure 11AAs shown, the storage command processing unit compresses the data block DU1 to obtain the compressed data block cDU1, and in response to the remaining storage space size corresponding to the current LBA1 being greater than the size of the data cDU1, returns LBA1 to the file system. The storage command processing unit stores the data block cDU1 in the storage space corresponding to LBA1. The file system generates a storage command (such as write(DU2, LBA1)) for the data block DU2 according to the LBA1 returned by the storage command processing unit. The storage command processing unit receives write(DU2, LBA1), compresses the data block DU2 to obtain the compressed data block cDU2, and in response to the remaining storage space size corresponding to the current LBA1 being greater than the size of the data cDU2, returns LBA1 to the file system. The storage command processing unit stores the data block cDU2 in the storage space corresponding to LBA1. In this case, the data blocks cDU1 and cDU2 are stored in the storage space corresponding to LBA1, but since the storage space corresponding to LBA1 is still remaining, the file system will continue to generate storage commands (such as write(DU3, LBA1)) for the data block DU3 according to LBA1. The storage command processing unit receives write(DU3, LBA1), compresses data block DU3 to obtain compressed data block cDU3, and returns LBA2 to the file system in response to the remaining storage space size corresponding to the current LBA1 being smaller than the size of data block cDU3. The storage command processing unit stores data block cDU3 in the storage space corresponding to LBA2. The file system will continue to generate storage commands for data block DU4 based on LBA2 (such as write(DU4, LBA2)). The storage command processing unit receives write(DU4, LBA2), compresses data block DU4 to obtain compressed data block cDU4, and returns LBA3 to the file system in response to the remaining storage space size corresponding to the current LBA2 being smaller than the size of data block cDU4. The storage command processing unit stores data block cDU4 in the storage space corresponding to LBA3. The file system will continue to generate storage commands for data block DU5 based on LBA3 (such as write(DU5, LBA3)). The storage command processing unit receives write(DU5, LBA3), compresses data block DU5 to obtain compressed data block cDU5, and returns LBA3 to the file system in response to the remaining storage space size corresponding to the current LBA3 being larger than the size of data block cDU5. The storage command processing unit stores data block cDU5 in the storage space corresponding to LBA3. At this point, the data corresponding to the file indicated by the custom command VU6 are all written to the LBA space of the storage device, where data blocks cDU1 and cDU2 are stored in the storage space corresponding to LBA1, data block cDU3 is stored in the storage space corresponding to LBA2, and data blocks cDU4 and cDU5 are stored in the storage space corresponding to LBA3.

[0213] Figure 11B shows the distribution of compressed data blocks in the LBA space after storing a file according to an Figure 11A embodiment. By way of example, the file data includes 5 data blocks (DU1 to DU5), and the compressed data blocks after compressing the data blocks are (cDU1 to cDU5) respectively. The compressed data blocks cDU1 and cDU2 are stored in the storage space corresponding to LBA1, the compressed data block cDU3 is stored in the storage space corresponding to LBA2, and the compressed data blocks cDU4 and cDU5 are stored in the storage space corresponding to LBA3.

[0214] In one case (denoted as case 1), the file system records the association relationship between the data block and the LBA address when writing the data block. At this time, for the Figure 11B example, the association relationship recorded by the file system is <fliename, <DU1, LBA1>, <DU2, LBA1>, <DU3, LBA1>, <DU4, LBA2>, <DU5, LBA3>>. The storage command processing unit only returns the LBA address as the new value of the file pointer after processing the data block. For example, when processing the data block DU3, the file pointer of the storage command issued by the file system for processing the data block DU3 indicates LBA1. However, since the remaining space corresponding to LBA1 is smaller than the size of the compressed data block cDU3 corresponding to the stored data block DU3, the storage command processing unit actually stores the data block cDU3 in the storage space corresponding to LBA2 and returns LBA2 to the file system. For the data block DU3, the LBA returned by the storage command processing unit to the file system is different from the LBA indicated by the file pointer of the storage command issued by the file system for processing the data block DU3. In this case, the storage command processing unit only returns the LBA address and does not return the LBA information of the storage space where the data block cDU3 is actually stored. The file system is not sure whether the compressed data block cDU3 corresponding to the data block DU3 is written into the storage space corresponding to LBA1 or the storage space corresponding to LBA2. When the file system records the file name, each data block corresponding to the file, and the LBA address corresponding to each data block, <DU3, LBA1> is recorded for the data block DU3. Similar to the data block DU3, the file system records <DU4, LBA2> for the data block DU4. For example, the file system records the file name, each data block corresponding to the file, and the LBA address corresponding to each data block as <fliename, <DU1, LBA1>, <DU2, LBA1>, <DU3, LBA1>, <DU4, LBA2>, <DU5, LBA3>>.

[0215] In another case (denoted as Case 2), in addition to indicating the new value of the file pointer, the storage command processing result also indicates the LBA address where the storage command actually writes the compressed data block. At this time, for Figure 11B the example of, the association relationship recorded by the file system is <fliename, <DU1, LBA1>, <DU2, LBA1>, <DU3, LBA2>, <DU4, LBA3>, <DU5, LBA3>>. For example, when processing data block DU3, the file pointer of the storage command issued by the file system for processing data block DU3 indicates LBA1. Since the remaining space corresponding to LBA1 is smaller than the size of the compressed data block cDU3 corresponding to the storage data block DU3, the storage command processing unit actually stores the data block cDU3 in the storage space corresponding to LBA2 and returns LBA2 and the LBA information (LBA2) of the storage space where the data block cDU3 is written to the file system. In this case, the file system knows that the compressed data block cDU3 corresponding to the data block DU3 is written to the storage space corresponding to LBA2. When the file system records the file name, each data block corresponding to the file, and the LBA address corresponding to each data block in an associated manner, <DU3, LBA2> is recorded for the data block DU3. Similar to the data block DU3, <DU4, LBA3> is recorded for the data block DU4 by the file system. For example, the file system records the file name, each data block corresponding to the file, and the LBA address corresponding to each data block in an associated manner as <fliename, <DU1, LBA1>, <DU2, LBA1>, <DU3, LBA2>, <DU4, LBA3>, <DU5, LBA3>>.

[0216] Regardless of which association relationship the file system records when storing file data, the file system according to the embodiments of the present application can read the data in the specified range of the file in response to a file read operation.

[0217] Figure 11C Show a schematic structural diagram of a control component provided by another embodiment of the present application.

[0218] As an example, such as Figure 11CAs shown, the host command processing unit in the control component receives the custom command VU7. In response to recognizing that the custom command VU7 indicates the file system basic operation fread(file_path_name, buf) for reading a file, the host command processing unit forwards the read file operation indicated by the custom command VU7 to the file system. In response to receiving the read file operation, the file system determines the LBA addresses of each data block (such as data block DU1, data block DU2, data block DU3, data block DU4, and data block DU5) corresponding to the file name indicated by the read file operation according to the mapping relationship recorded between the file system record file name, each data block corresponding to the file, and the LBA address corresponding to each data block. A storage command is generated based on the LBA address and sent to the storage command processing unit. The storage command processing unit processes each storage command to read each compressed data block (such as compressed data block cDU1, compressed data block cDU2, compressed data block cDU3, compressed data block cDU4, and compressed data block cDU5) from the storage device. The storage command processing unit performs a decompression operation on the compressed data block to obtain the data block (such as data block DU1, data block DU2, data block DU3, data block DU4, and data block DU5) corresponding to the file to be operated on indicated by the read file operation, and sends it to the file system according to each data block corresponding to the file to be operated on indicated by the read file operation. The file system merges each data block corresponding to the file to be operated on indicated by the read file operation to determine the file to be operated on indicated by the read file operation, and sends the file to, for example, the host or the FPGA device, etc.

[0219] Taking Figure 11A the data storage method of the storage file shown as an example, the process of reading partial data in the file is introduced in detail. See Figure 11D shown.

[0220] Figure 11D Schematic diagram showing the process of the file system processing the read file operation provided by another embodiment of the present application.

[0221] As an example, such as Figure 11DAs shown, the host command processing unit in the control component receives the custom command VU8. The host command processing unit responds to recognizing that the custom command VU8 indicates a file reading operation fread(file_path_name, buf, offset1, length1); and sends the file reading operation to the file system. In response to receiving the file reading operation, the file system determines that the file data to be read is located in data block DU3 according to the offset offset1 and the length length1. For example, in case 1 where the file system is associated with recording the file name, each data block corresponding to the file, and the LBA address corresponding to each data block as <fliename, <DU1, LBA1>, <DU2, LBA1>, <DU3, LBA1>, <DU4, LBA2>, <DU5, LBA3>>, the file system generates a storage command Read(LBA1) based on the LBA1 in <DU3, LBA1> recorded, and sends the storage command Read(LBA1) to the storage command processing unit, denoted as process (1). The storage command processing unit processes the storage command Read(LBA1) to read the data blocks cDU1 and cDU2 stored in the storage space corresponding to LBA1, and decompresses cDU1 and cDU2 respectively to obtain data blocks DU1 and DU2, denoted as process (2). The storage command processing unit sends the data blocks DU1 and DU2 to the file system. After receiving the data blocks DU1 and DU2, the file system knows that DU3 is not stored in the storage space corresponding to LBA1. The file system then generates a storage command Read(LBA2) using LBA2 (for example, LBA2 = LBA1 + 1, or obtains the LBA address (LBA2) corresponding to DU4), and sends Read(LBA2) to the storage command processing unit, denoted as process (3). The storage command processing unit processes the storage command Read(LBA2) to read the data block cDU3 stored in the storage space corresponding to LBA2, and decompresses cDU3 to obtain data block DU3, denoted as process (4). The storage command processing unit sends the data block DU3 to the file system. In this case, the control component reads out the data block DU3 by executing process (1)->process (2)->process (3)->process (4).

[0222] Optionally, in the association relationship between the data blocks and the LBA addresses recorded by the file system, there are 3 data blocks associated with LBA1, and 2 data blocks read from LBA1, so as to identify that data block DU3 is not stored in the storage space corresponding to LBA1. Still optionally, the data block numbers are recorded in the data blocks, so as to identify that data block DU3 is not stored in the storage space corresponding to LBA1 according to the fact that the data block numbers "3" are not included in the data blocks read from LBA1.

[0223] For another example, in order to read data block DU3, the file system records the file name, each data block corresponding to the file, and the LBA address corresponding to each data block in association, which is case 2, i.e., <fliename, <DU1, LBA1>, <DU2, LBA1>, <DU3, LBA2>, <DU4, LBA3>, <DU5, LBA3>>. The file system generates a storage command Read(LBA2) based on LBA2 in the recorded <DU3, LBA2>, and sends the storage command Read(LBA2) to the storage command processing unit, which is represented as process (5). The storage command processing unit processes the storage command Read(LBA2) to read the data block cDU3 stored in the storage space corresponding to LBA2, and decompresses cDU3 to obtain the data block DU3, which is represented as process (6). The storage command processing unit sends the data block DU3 to the file system. In this case, the control component reads out the data block DU3 by executing process (5) -> process (6).

[0224] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications 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 storage device response method, characterized in that, including: receiving a custom command sent by an FPGA device, which 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; processing the basic operations of the file system carried by the custom command by using the file system, and obtaining a processing result; generating response information of the custom command according to the processing result and sending it to the FPGA device; wherein, in response to the file system basic operation indicating writing a file, compressing the file indicated to be operated by the file system basic operation, and storing the data corresponding to the compressed file into the LBA space of the storage device; or in response to the file system basic operation indicating reading a file, reading the data corresponding to the compressed file from the LBA space of the storage device, and decompressing the data to obtain the file indicated to be operated by the file system basic operation.

2. The method according to claim 1, characterized in that, wherein, in response to the file system basic operation indicating writing a file, the file system caches the file data of the file indicated to be operated by the write file; and in response to all the file data being cached, the file system compresses the file data to obtain compressed file data; and stores the compressed file data into the LBA space of the storage device.

3. The method according to claim 1 or 2, characterized in that, further including, in response to the file system basic operation indicating writing a file, the file system splits the file data of the file indicated to be operated by the write file into multiple first data blocks with a specified size; and the file system respectively performs a compression operation on each first data block to obtain its corresponding compressed second data block; stores the second data block corresponding to each first data block into the LBA space of the storage device.

4. The method according to claim 3, wherein wherein, in response to the file system basic operation being reading a file, the file system determines at least one first LBA address corresponding to the file indicated to be operated by the read file; and generates a first storage command according to each first LBA address, and reads the second data block corresponding to the file indicated to be operated by the read file from the LBA space of the storage device according to each first storage command; and performs a decompression operation on each second data block to obtain the first data block corresponding to each second data block before compression; and sequentially combines the respective first data blocks to obtain the file indicated to be operated by the read file.

5. The method according to any one of claims 1-4, characterized in that, wherein, in response to the file system basic operation indicating writing a file, the file system splits the file data of the file indicated to be operated by the write file into multiple third data blocks, and generates a second storage command for each third data block according to the LBA address represented by the file pointer; wherein, the size of each third data block is the same as the storage space size indicated by each LBA address; processing the second storage command corresponding to each third data block, performing a compression operation on each third data block to obtain a compressed fourth data block; and sequentially storing the fourth data block corresponding to each third data block into the LBA space of the storage device.

6. The method according to claim 5, characterized in that, wherein, In response to the file system basic operation being a file read operation, determine the LBA addresses corresponding to each third data block of the file to be operated on indicated by the file read operation, using the file name recorded in association with the file system, each third data block corresponding to the file, and the LBA address corresponding to each third data block; Generate a third storage command based on each LBA address, and process each third storage command to read out the fourth data block corresponding to each third data block from the LBA space; Perform a decompression operation on each fourth data block to obtain its corresponding third data block, and splice the third data blocks in order to obtain the file to be operated on indicated by the file read operation.

7. The method according to claim 6, wherein Wherein, In response to the file system basic operation being a file read operation, wherein the file read operation indicates to read a part of the file data in the file to be operated on indicated by the file read operation; The file system determines the range of the partial file data, and determines the third data blocks corresponding to the partial file data according to the range; and Determine the second LBA address corresponding to the third data block according to the file name recorded in association with the file system, each third data block corresponding to the file, and the LBA address corresponding to each third data block; Generate a fourth storage command according to the second LBA address corresponding to the third data block, and read the third data block according to the fourth storage command.

8. The method according to claim 7, characterized in that, Wherein, If the third data block read out by processing the fourth storage command includes the partial file data to be read, return the partial file data to be read; and / or If the third data block read out by processing the fourth storage command does not include the partial file data to be read, add 1 to the second LBA address to obtain a third LBA address; And generate a fifth storage command according to the third LBA address, read the corresponding third data block according to the fifth storage command, extract the partial file data to be read from the third data block corresponding to the fifth storage command, and return the partial file data to be read.

9. 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 the file system basic operation and complies with the NVMe protocol, wherein the FPGA device does not have the function of a file system; In response to the file system basic operation indicating a file write operation, the file system compresses the file to be operated on indicated by the file system basic operation, generates a storage command to store the data corresponding to the compressed file into the LBA space of the storage device; or in response to the file system basic operation indicating a file read operation, generates a storage command to read the data corresponding to the compressed file from the LBA space of the storage device, and decompresses the data to obtain the file to be operated on indicated by the file system basic operation; and The storage device command processing unit processes the storage commands generated by the file system.

10. 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 out basic operations of the file system and complies with the NVMe protocol, wherein the FPGA device does not have the function of the file system; In response to the file system basic operation indicating writing a file, the file system splits the file data of the file to be operated indicated by the write file into multiple data blocks, and generates a storage command for each data block according to the LBA address represented by the file pointer for each data block; wherein, the size of each data block is the same as the storage space size indicated by each LBA address; The storage command processing unit processes the storage command corresponding to each data block, performs a compression operation on each data block to obtain a compressed data block; and sequentially stores the compressed data block corresponding to each data block into the LBA space of the storage device.