Method for achieving RAID through file system SSD

By generating custom NVMe commands in devices without a file system to directly access the logical address space of the storage device, the resource consumption problem in RAID1 functionality is solved, and high-performance RAID1 functionality compatibility is achieved.

CN120832077APending Publication Date: 2025-10-24BEIJING STARBLAZE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410494437.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-23
Publication Date
2025-10-24

AI Technical Summary

Technical Problem

Existing technologies require copying the LBA of file system operations when implementing RAID1 functionality, which consumes CPU or hardware resources, leading to performance degradation. Furthermore, devices without file system functionality cannot implement RAID1.

Method used

By generating and sending custom NVMe commands that carry basic file system operations, the logical address space of the storage device can be directly accessed, avoiding the LBA copying process. RAID1 can be implemented in devices without a file system using custom commands.

Benefits of technology

It reduces CPU and hardware load, improves device performance, and achieves RAID1 compatibility, making it suitable for various RAID technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120832077A_ABST
    Figure CN120832077A_ABST
Patent Text Reader

Abstract

The invention provides a method for achieving RAID through a file system SSD, and the method applied to electronic equipment without a file system function comprises the steps that in response to a first file system basic operation indicating a file writing operation, a first custom command and a second custom command which bear the file system basic operation and follow an NVMe protocol are generated; sending the first custom command to the first storage device, and sending the second custom command to the second storage device to access a first logic address space managed by the first storage device and a second logic address space managed by the second storage device; the first user-defined command and the second user-defined command both bear the basic operation of the first file system. The RAID1 function can be achieved by accessing the storage device for the device without the file system function, the hardware burden when the RAID1 function is achieved is reduced, and the device performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of storage devices, and in particular to a method for implementing RAID using a file system SSD. BACKGROUND

[0002] Figure 1A A block diagram of a storage device is shown. The storage device 102 is coupled to a host to provide storage capability for the host. The host and the storage device 102 can be coupled in a variety of ways, including but not limited to through a variety of storage protocols such as SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIE (Peripheral Component Interconnect Express), NVMe (NVM Express), Ethernet, Fibre Channel, wireless communication network, etc. The host can be an information processing device capable of communicating with the storage device in the above manners, such as a personal computer, a tablet computer, a server, a laptop computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 102 includes an interface 103, a control component 104, one or more NVM chips 105, and a DRAM (Dynamic Random Access Memory) 110.

[0003] NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), XPoint memory, etc. are common NVMs.

[0004] The interface 103 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 configured to control data transfer between the interface 103, the NVM chip 105, and the DRAM 110, and is also configured to perform storage management, host logical address to flash physical address mapping, wear leveling, bad block management, etc. The control component 104 can be implemented in various manners, such as software, hardware, firmware, or a combination thereof. For example, the control component 104 can be in the form of an FPGA (Field-programmable gate array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control component 104 can also include a processor or a controller, in which software is executed to manipulate the hardware of the control component 104 to process IO (Input / Output) commands. The control component 104 can also be coupled to the DRAM 110 and can access data of the DRAM 110. The DRAM can store the FTL table and / or buffered IO command data.

[0006] The control component 104 includes a flash interface controller (or referred to as a media interface controller, a flash channel controller) coupled to the NVM chip 105 and configured to issue commands to the NVM chip 105 in a manner complying with an interface protocol of the NVM chip 105 to operate the NVM chip 105 and receive results of command execution 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 complying with the NVMe protocol. The control component generates one or more media interface commands from the NVMe command from the host and provides the media interface commands to the media interface controller. The media interface controller generates storage media access commands (e.g., program commands, read commands, erase commands) complying with the interface protocol of the NVM chip from the media interface commands. The control component also tracks that all media interface commands generated from one NVMe command are executed to completion and indicates the processing result of the NVMe command to the host.

[0009] Referring to Figure 1BThe control components include, 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 NVMe commands provided by the host and generates storage commands to provide to the storage command processing unit. The storage commands, for example, access storage space of the same size, such as 4KB. A data unit corresponding to the data accessed by one storage command recorded in the NVM chip is referred to as a data frame. A physical page records one or more data frames. For example, the size of a physical page is 17664 bytes, and the size of a data frame is 4KB, so one physical page can store 4 data frames.

[0010] The storage media management unit maintains the conversion of 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, and for a write command, the storage media management unit allocates an available physical address therefor and records the mapping relationship between the logical address accessed thereby and the allocated physical address.

[0011] The storage command processing unit operates the media interface controller to issue storage media access commands to the NVM chip according to the physical addresses provided by the storage media management unit. For the purpose of clarity, the commands sent by the host to the storage device are referred to as NVMe commands, the commands sent by the host command processing unit to the storage command processing unit are referred to as storage commands, the commands sent by the storage command processing unit to the media interface controller are referred to as media interface commands, and the commands sent by the media interface controller to the NVM chip are referred to as storage media access commands. The storage media access commands comply with the interface protocol of the NVM chip.

[0012] RAID (Redundant Arrays of Independent Disks) is a kind of multi-disk management technology, which is composed of multiple independent disks to provide higher storage performance and data redundancy than a single disk. RAID mainly uses data striping, mirroring, and data checking technology to obtain high performance, reliability, fault tolerance, and scalability. According to the strategy and architecture of using or combining these three technologies, RAID can be divided into different levels, such as RAID0~RAID5, etc. Each level of RAID represents an implementation method and technology, and there is no difference between levels. Among them, RAID1 is called mirroring, which writes the same data into two disks (working disk and mirror disk) without difference when writing data to the disk, which is equivalent to making a redundant backup for the data. For RAID0, multiple disks are combined to form a large-capacity storage, and each disk can store different data.

[0013] Currently, RAID implementation methods include soft RAID and hardware RAID. Soft RAID does not have dedicated control chips and I / O chips, and the RAID function is implemented based on the operating system and CPU (Central Processing Unit). Hardware RAID has RAID control processing and I / O processing chips, such as RAID cards and RAID chips integrated on the motherboard, and the RAID function is implemented by RAID cards or RAID chips.

[0014] Figure 2A A schematic diagram showing the existing technology using soft RAID to implement RAID1 function.

[0015] like Figure 2A As shown, the host / FPGA device is coupled with two storage devices (storage device 1 and storage device 2), where storage device 2 is a mirror storage device of storage device 1. The host / FPGA device includes an application, a file system, a soft RAID (such as an operating system and a CPU), and an NVMe driver circuit. The process by which the host / FPGA device accesses the storage device using the soft RAID method to implement the RAID1 function is as follows: the application generates basic file system operations based on user requirements, and the file system determines the corresponding LBA based on the basic file system operations; the LBA is then copied by the operating system and CPU corresponding to the soft RAID to obtain two identical LBAs. The NVMe driver circuit generates two identical NVMe commands based on the two identical LBAs and sends the two identical NVMe commands to storage device 1 and storage device 2 respectively. Storage device 2 is a mirror storage device of storage device 1.

[0016] Figure 2B A schematic diagram showing the existing technology using hardware RAID to implement RAID1 function.

[0017] like Figure 2BAs shown, the host / FPGA device includes an application, a file system, and an NVMe drive circuit. A hard RAID component (such as a dedicated RAID control processing and I / O processing chip corresponding to the hard RAID) is arranged peripherally to the host / FPGA device, and the host / FPGA device communicates with the storage devices (storage device 1 and storage device 2) through the hard RAID component. The application in the host / FPGA device generates a file system basic operation according to user demand, and the file system determines the corresponding LBA according to the file system basic operation; the NVMe drive circuit generates an NVMe command based on the LBA, and sends the NVMe command to the hard RAID component. The hard RAID component receives the NVMe command, parses the LBA from the NVMe command, and replicates the LBA to obtain two identical LBAs, encapsulates the two LBAs to generate two new NVMe commands, and sends the two new NVMe commands to the storage device 1 and the storage device 2 respectively. The storage device 2 is a mirror storage device of the storage device 1. SUMMARY

[0018] In view of the prior art, the device (such as a host or FPGA device) coupled with the storage device has a file system, which can provide access to the storage device in a block device manner based on the file system and through a soft RAID or a hard RAID. In the process of implementing the RAID1 function in the block device manner, two identical NVMe commands need to be provided to write the same data into two storage devices (one is a main storage device, and the other is a backup storage device of the main storage device) through the two identical NVMe commands. In order to generate the two identical NVMe commands, whether a soft RAID or a hard RAID is used to implement the RAID1 function, the LBA determined by the file system according to the file system operation needs to be copied. However, the CPU resource needs to be occupied for copying the LBA for the soft RAID, and the hardware resource supporting the hard RAID needs to be occupied for copying the LBA for the hard RAID. Whether it is the CPU resource or the hardware resource supporting the hard RAID, both are limited, and copying the LBA increases the CPU or hardware burden, which further affects the device performance. In addition, in some special scenarios, the host or FPGA device may not have a file system or file system function, and it cannot use the prior art to access the storage device to implement the RAID1 function. The present application hopes that the host or FPGA device without a file system and a file system function can access the storage device to implement the RAID1 function, and in the process of implementing the RAID1 function, the CPU or hardware burden in implementing the RAID1 function can be reduced, and the device performance can be improved. In addition, the RAID technology includes various implementation methods and technologies (such as RAID0-RAID5), and the present application hopes that the scheme provided can be compatible with as many implementation methods and technologies as possible included in the RAID technology.

[0019] In a first aspect, the embodiments of the present application provide a method for accessing a storage device, applied to an electronic device, the electronic device being coupled with a first storage device and a second storage device, and not having a file system function, the method comprising:

[0020] generating a first custom command and a second custom command carrying a file system basic operation and complying with an NVMe protocol in response to the first file system basic operation indicating a write file operation;

[0021] sending the first custom command to the first storage device and the second custom command to the second storage device to access a first logical address space managed by the first storage device and a second logical address space managed by the second storage device;

[0022] wherein the first custom command and the second custom command both carry the first file system basic operation.

[0023] Optionally, the method further comprises:

[0024] generating a third custom command carrying the first file system basic operation and complying with the NVMe protocol in response to the first file system basic operation indicating the write file operation;

[0025] generating a fourth custom command carrying the second file system basic operation and complying with the NVMe protocol in response to the second file system basic operation indicating the write file operation;

[0026] sending the third custom command to the first storage device and the fourth custom command to the second storage device to access the first logical address space managed by the first storage device and the second logical address space managed by the second storage device.

[0027] Optionally, the first custom command is generated based on the first file system basic operation, and the second custom command identical to the first custom command is obtained by copying the first custom command; or,

[0028] the first file system basic operation is copied to obtain a third file system basic operation identical to the first file system basic operation, and the first custom command and the second custom command identical to the first custom command and the second custom command are generated based on the first file system basic operation and the third file system basic operation.

[0029] Optionally, in response to the first file system basic operation and the second file system basic operation being the same file system basic operation, the third custom command and the fourth custom command carry the same file system basic operation; or

[0030] in response to the first file system basic operation and the second file system basic operation being different file system basic operations, the third custom command and the fourth custom command carry different file system basic operations.

[0031] Optionally, in response to the first custom command and the second custom command carrying the same file system basic operation, the same file data is written into the first logical address space of the first storage device and the second logical address space of the second storage device based on the first custom command and the second custom command respectively.

[0032] Optionally, in response to the third custom command and the fourth custom command carrying different file system basic operations indicating write file operations, different file data is written into the first logical address space of the first storage device and the second logical address space of the second storage device based on the third custom command and the fourth custom command respectively.

[0033] Optionally, the first logical address space and the second logical address space are independent of each other; the first storage device manages file data written into the first logical address space through a first file system, and the second storage device manages file data written into the second logical address space through a second file system.

[0034] Optionally, in response to the first custom command and the second custom command carrying the same file system basic operation indicating a write file operation, the file data managed by the first file system of the first storage device is the same as the file data managed by the second file system of the second storage device.

[0035] in response to the third custom command and the fourth custom command carrying different file system basic operations indicating write file operations, the file data managed by the first file system of the first storage device is different from the file data managed by the second file system of the second storage device.

[0036] Optionally, in response to sending the first custom command to the first storage device and sending the second custom command to the second storage device, the second storage device is a mirror storage device of the first storage device.

[0037] Optionally, in response to generating the fourth file system basic operation of the read file operation, a fifth custom command is generated, which carries the fourth file system basic operation and complies with the NVMe protocol, and the fifth custom command is sent to the first storage device;

[0038] In response to the first storage device failing, the data reading based on the fifth custom command fails, a sixth custom command is generated, which carries the fourth file system basic operation and complies with the NVMe protocol, and the sixth custom command is sent to the second storage device to read the file data corresponding to the fourth file system basic operation from the second storage device based on the sixth custom command.

[0039] Optionally, in response to the first storage device failing, the electronic device is further coupled with a third storage device;

[0040] The file data in the second logical address space of the second storage device is copied, and the copied file data is moved to the third storage device.

[0041] Optionally, in response to the fifth file system basic operation indicating the write file operation, the same seventh custom command and eighth custom command are generated based on the fifth file system basic operation;

[0042] The seventh custom command is sent to the second storage device, and the eighth custom command is sent to the third storage device, so as to write the file data indicated by the fifth file system basic operation to the second storage device and to the third storage device.

[0043] In a second aspect, an embodiment of the present application provides an electronic device, which comprises an application program, an NVMe drive circuit and a RAID module;

[0044] The application program generates a first file system basic operation indicating a write file operation;

[0045] The NVMe drive circuit cooperates with the RAID module to generate a first custom command and a second custom command, which carry the first file system basic operation and comply with the NVMe protocol;

[0046] The NVMe drive circuit or the RAID module sends the first custom command to a first storage device and sends the second custom command to a second storage device, so as to access a first logical address space of the first storage device and a second logical address space of the second storage device.

[0047] Optionally, the application program generates a first file system basic operation indicating a write file operation and generates a second file system basic operation indicating a write file operation;

[0048] the NVMe drive circuit and the RAID module cooperate to generate a third custom command carrying the first file system basic operation and complying with the NVMe protocol and generate a fourth custom command carrying the second file system basic operation and complying with the NVMe protocol;

[0049] the NVMe drive circuit or the RAID module sends the third custom command to the first storage device and sends the fourth custom command to the second storage device to access a first logical address space of the first storage device and a second logical address space of the second storage device.

[0050] In a third aspect, an embodiment of the present application provides a data processing system, including an electronic device, a first storage device and a second storage device, the electronic device does not have a file system function;

[0051] the electronic device is coupled with the first storage device and the second storage device, generates a first custom command and a second custom command carrying a file system basic operation and complying with the NVMe protocol based on a first file system basic operation indicating a write file operation, sends the first custom command to the first storage device and sends the second custom command to the second storage device, and the first custom command and the second custom command both carry the first file system basic operation;

[0052] the first storage device processes the file system basic operation carried by the first custom command by using a first file system and obtains a processing result, and generates response information of the first custom command and sends the response information to the electronic device;

[0053] the second storage device processes the file system basic operation carried by the second custom command by using a second file system and obtains a processing result, and generates response information of the second custom command and sends the response information to the electronic device.

[0054] Optionally, the electronic device generates a third custom command carrying the first file system basic operation and complying with the NVMe protocol based on a first file system basic operation indicating a write file operation, and generates a fourth custom command carrying the second file system basic operation and complying with the NVMe protocol based on a second file system basic operation indicating a write file operation;

[0055] the electronic device sends the third custom command to the first storage device and sends the fourth custom command to the second storage device to access a first logical address space managed by the first storage device and a second logical address space managed by the second storage device;

[0056] The first storage device processes the file system basic operation carried by the third custom command by using a first file system and obtains a processing result, and generates response information of the third custom command and sends the response information to the electronic device;

[0057] The second storage device processes the file system basic operation carried by the fourth custom command by using a second file system and obtains a processing result, and generates response information of the fourth custom command and sends the response information to the electronic device.

[0058] In a fourth aspect, an embodiment of the present application provides a data processing method, comprising:

[0059] The electronic device generates a first custom command and a second custom command carrying a file system basic operation and complying with an NVMe protocol based on a first file system basic operation indicating a write file operation;

[0060] The electronic device sends the first custom command to a first storage device and sends the second custom command to a second storage device; wherein the first custom command and the second custom command both carry the first file system basic operation;

[0061] The electronic device receives response information fed back by the first storage device processing the file system basic operation carried by the first custom command, and receives response information fed back by the second storage device processing the file system basic operation carried by the second custom command.

[0062] Optionally, the electronic device generates a third custom command carrying the first file system basic operation and complying with the NVMe protocol based on the first file system basic operation indicating the write file operation;

[0063] The electronic device generates a fourth custom command carrying the second file system basic operation and complying with the NVMe protocol based on a second file system basic operation indicating a write file operation;

[0064] The electronic device sends the third custom command to the first storage device and sends the fourth custom command to the second storage device, so as to access a first logical address space managed by the first storage device and a second logical address space managed by the second storage device;

[0065] The electronic device receives response information fed back by the first storage device processing the file system basic operation carried by the third custom command, and receives response information fed back by the second storage device processing the file system basic operation carried by the fourth custom command.

[0066] According to an embodiment of the present application, an electronic device that does not have a file system function generates two identical custom commands that carry the same basic file system operations, and sends these two identical custom commands to a first storage device and a second storage device that serves as a mirror storage device of the first storage device, respectively, for backing up data in the storage devices, so that the two storage devices can be accessed with high performance in the form of files based on the two identical custom commands, thereby realizing RAID1 function. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0068] Figure 1B A detailed block diagram showing the control components of a storage device;

[0069] Figure 2A Demonstrates that soft RAID uses LBA replication to implement RAID1;

[0070] Figure 2B Demonstrates that hardware RAID uses LBA duplication to implement RAID1;

[0071] Figure 3A Indicates the format of a custom command provided in one embodiment of the present application;

[0072] Figure 3B Indicates the format of a custom command provided in another embodiment of the present application;

[0073] Figure 3C Indicates the format of a custom command provided in yet another embodiment of the present application;

[0074] Figure 4A Indicates the format of a custom command provided in another embodiment of the present application;

[0075] Figure 4B Indicates the format of a custom command provided in another embodiment of the present application;

[0076] Figure 4C Indicates the format of a custom command provided in another embodiment of the present application;

[0077] Figure 5 A block diagram showing a storage device supporting basic file system operations provided by an embodiment of the present application;

[0078] Figure 6 A schematic diagram showing an FPGA device provided in an embodiment of the present application accessing a storage device through a custom command;

[0079] Figure 7 A schematic diagram showing a host accessing a storage device through an IO command provided by an embodiment of the present application;

[0080] Figure 8 a block diagram of a storage device according to another embodiment of the present application;

[0081] Figure 9 a block diagram of a storage device according to another embodiment of the present application;

[0082] Figure 10 a schematic diagram of an electronic device according to an embodiment of the present application accessing two storage devices to implement RAID 1 function through a custom command;

[0083] Figure 11 a schematic diagram of an electronic device according to another embodiment of the present application accessing two storage devices to implement RAID 1 function through a custom command;

[0084] Figure 12 a schematic diagram of an electronic device according to an embodiment of the present application accessing two storage devices to implement RAID 0 function through two custom commands;

[0085] Figure 13 a schematic diagram of an electronic device according to another embodiment of the present application accessing two storage devices to implement RAID 0 function through two custom commands.

[0086] Related technical terms

[0087] File system basic operation: a basic operation on a file in the form of a file system, such as reading, writing, deleting, opening or creating a file;

[0088] Custom command: a command in the form or format of a storage protocol definition, carrying a file system basic operation;

[0089] File system: an executable program providing file system functions, or a hardware unit implementing file system functions;

[0090] File system data: including file system metadata and file data, the file system metadata being used to describe the hierarchical directory structure of a file system, the attributes of a file / directory, the storage location of file data, etc.; the file data representing data constituting a file itself;

[0091] File system path: describing the path of a directory / file in a hierarchical directory structure in a file system;

[0092] OP: indicating the operation type corresponding to a file system basic operation;

[0093] FILEOBJ: indicating the file parameter corresponding to a file system basic operation;

[0094] PRP List: used to index multiple PRP entries in a read operation or a write operation, each PRP entry is used to index a fixed size (such as 4K) of host memory or FPGA device memory;

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

[0096] Inode: a data structure constituting file system metadata, the file system metadata includes multiple inodes, each inode can have a specific size and is recorded in the logical address space of the storage device. DETAILED DESCRIPTION

[0097] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of the present application.

[0098] In the embodiments of the present application, the electronic device does not mount the file system, does not run the file system in the form of software, 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, for example, the electronic device is a host or an FPGA device. The electronic device without a file system generates two same custom commands carrying the same file system basic operation through soft RAID or hard RAID, and sends the two same custom commands to two storage devices respectively; one of the two storage devices is a working storage device; one is a mirror storage device of the working storage device, used to backup the data in the working storage device, so that the two storage devices are accessed in the form of files based on the two same custom commands, and the function of RAID1 is realized.

[0099] The electronic device according to the embodiments of the present application accesses the storage device by sending the custom command provided by the embodiments of the present application to the storage device. The custom command provided by the embodiments of the present application conforms to the storage protocol definition (such as NVMe protocol) in the form or format of the command, the custom command carries the file system basic operation, and the specific information indicated by the command content is different based on the difference of the command type (operation type of the file system basic operation). The electronic device and the storage device interact through the custom command (carrying the file system basic operation), so that the storage device processes the file system basic operation by processing the custom command, and the electronic device accesses the storage device in the form of the file system.

[0100] According to the electronic device of the embodiment of the present application, the logical address space provided by the storage device is used by accessing the storage device in the form of a file. After the electronic device writes file data to the storage device in the form of a file, the file system metadata and the file data, collectively referred to as file system data, are recorded in the LBA space of the storage device.

[0101] The file system basic operations include, for example, the following operations:

[0102] fopen(file_path_name) indicates opening or creating a file, where file_path_name is, for example, a string representing the file system path and the file name of the file being operated;

[0103] fwrite(file_path_name, data) indicates writing file data, where file_path_name represents the file system path and the file name of the file being operated, and data represents the data to be written;

[0104] fread(file_path_name, buf) indicates reading file data, where file_path_name represents the file system path and the file name of the file being operated, and buf represents the memory buffer for containing the read data;

[0105] fdelete(file_path_name) indicates deleting file data, where file_path_name represents the file system path and the file name of the file being operated;

[0106] fset(file_path_name, attribute, value) indicates setting and modifying file attributes, where file_path_name represents the file system path and the file name of the file being operated, attribute represents the attribute name to be modified, and value represents the new value of the attribute;

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

[0108] fsquery indicates querying the file system status, such as the total number of clusters, the cluster size, and whether each cluster is used or not, of the current partition of the file system;

[0109] format indicates formatting the file system;

[0110] fmnt indicates loading and unloading the file system;

[0111] The fdisk instructs partition creation and management operations, such as creating a partition, deleting a partition, viewing a partition, and the like. The custom command according to the embodiments of the present application includes at least a field containing OP and a field containing PRPList, and optionally a field containing FILEOBJ.

[0112] The custom command has a size specified in the NVMe protocol, for example, the custom command includes 16 DWORDs (double words, each with a size of 64 bits), different DWORDs indicate different contents, for example, the 10th DWORD is OP, indicating the operation type of the file system basic operation, which can indicate fopen, fwrite, fread, flist, and the like; the 11th DWORD is FILEOBJ, indicating the file parameter corresponding to the file system basic operation, including file_Path_name, attribute, and the like (for example, all parameters except data and buf); the 12th and 13th DWORDs are PRPList, indicating the device memory space corresponding to data and buf.

[0113] Since the string length of file_path_name indicated by FILEOBJ is indefinite and can exceed the size of the custom command, the size of data / buf will change with the data size of the read / write file, and often exceeds the size of the custom command, so an improved technical solution is needed to enable the custom command with a fixed size and format to carry various file system basic operations and file parameters, data / buf, of the file system basic operation length / form / quantity variation.

[0114] Figure 3A The format of the custom command provided by an embodiment of the present application is shown.

[0115] As an example, refer to Figure 3A , the custom command carrying the file system basic operation includes a field containing OP, a field containing FILEOBJ, and a field containing PRPList. The field containing OP is, for example, 10 bits in size, the field containing FILEOBJ is, for example, 1 DWORD in size, and the field containing PRPList is, for example, 1 or several DWORDs in size. As an example, the same format as the NVMe IO command in the NVMe protocol is used to carry PRPList in the custom command of the embodiments of the present application.

[0116] Since 1 DWORD only includes 64 bits, the field to hold the FILEOBJ is, for example, 1 DWORD size, and when holding the FILEOBJ, the information carried by the FILEOBJ cannot exceed 64 bits. For example, when the custom command indicates fileopen(file_path_name), the FILEOBJ includes the file_path_name, and the size of the file_path_name cannot exceed 64 bits. For fileopen(" / a.o"), the file path length is small, and thus the file_path_name can be carried in the custom command format shown in Figure 3A For fileopen(" / root / bin / foo.txt"), the file path length is much larger than 64 bits, and thus the file_path_name cannot be carried in the custom command format shown in Figure 3A .

[0117] In an embodiment of Figure 3A , the PRPList includes, for example, 1 or 2 PRP entries, which are completely held in the custom command. When the PRPList includes, for example, more PRP entries, the PRP entries cannot be held in the custom command due to the excessive number, and thus the custom command format shown in Figure 3A cannot be used.

[0118] Figure 3B The custom command format provided by another embodiment of the present application is shown.

[0119] As an example, referring to Figure 3B , the custom command carrying the file system basic operation includes a field to hold the OP, a field to hold the FILEOBJ ptr, and a field to hold the PRPList. The field to hold the OP is, for example, 10 bits in size, the field to hold the FILEOBJ ptr is, for example, 1 DWORD in size, and the field to hold the PRPList is, for example, 1 or several DWORDs in size. As an example, the PRPList is carried in the custom command of the embodiment of the present application in the same format as the NVMe IO command in the NVMe protocol carries the PRPList.

[0120] In an embodiment of Figure 3BThe custom command shown does not directly accommodate the field of the FILEOBJ, but accommodates the field of the FILEOBJ ptr. The FILEOBJ ptr indicates the index of the FILEOBJ (such as the pointer of the FILEOBJ), which is used to index the recorded FILEOBJ in the specified memory space. While the FILEOBJ index is an index of the indexed FILEOBJ, the size of the FILEOBJ index is irrelevant to the size of the FILEOBJ, and as an index, the size of the FILEOBJ index will not exceed 64 bits, for example, the FILEOBJ index is 15 bits in size, and the FILEOBJ index can be fully accommodated by, for example, 1 DWORD size (64 bits).

[0121] For example, the custom command indicates fdelect(file_path_name), where the file_path_name is " / root / bin / foo.txt", and the size of the file_path_name exceeds 64 bits. Since the FILEOBJ exceeds 64 bits, it cannot be directly accommodated by 1 DWORD in the custom command. The embodiment of the present application adopts Figure 3B The custom command format shown does not directly accommodate the FILEOBJ in the custom command, but records the index of the FILEOBJ through the field of the FILEOBJ ptr in the custom command, and then indexes to the specified memory space through the index of the FILEOBJ, and the FILEOBJ is recorded in the specified memory space. For example, the size of the specified memory space is 4 KB, which is sufficient to accommodate " / root / bin / foo.txt".

[0122] Figure 3C The format of the custom command provided by another embodiment of the present application is shown.

[0123] For example, referring to Figure 3C The custom command carrying the basic operation of the file system does not directly accommodate the field of the FILEOBJ, but only includes the field of the OP and the field of the PRPList. The field of the OP is, for example, 10 bits in size, and the field of the PRPList is, for example, 1 or several DWORD sizes. For example, in the custom command of the embodiment of the present application, the index (such as the pointer of the first PRP entry) of the first PRP entry of the PRPList is recorded in the field of the PRPList. The field of the PRPList records the index of the first PRP entry of the PRPList, which is used to index the first PRP entry (such as PRP0) of the PRPList, and through the first PRP entry of the PRPList, it indexes to the corresponding specified size memory space (such as 4 KB), in which the FILEOBJ is recorded, and then the FILEOBJ is found.

[0124] As an example, fileopen(" / root / bin / foo.txt"), the file path length is far more than 64 bits, the FILEOBJ is more than 64 bits. Since the FILEOBJ is more than 64 bits, it cannot be directly contained in the custom command by 1 DWORD. Embodiments of the present application adopt Figure 3C The custom command format shown above, the custom command does not directly contain the FILEOBJ, but records the FILEOBJ in the memory space corresponding to the first PRP entry. By containing the index of the first PRP entry of the PRPList in the field of the custom command, the first PRP entry is indexed by the index of the first PRP entry, and the corresponding memory space of the first PRP entry is indexed by the first PRP entry to find the FILEOBJ. The FILEOBJ is stored in, for example, 4 KB of memory space, which is enough to contain " / root / bin / foo.txt".

[0125] As another example, the PRPList includes 11 PRP entries, PRP0, PRP1, PRP2, PRP3, PRP4, PRP5, PRP6, PRP7, PRP8, PRP9 and PRP10. Since the PRPList includes more PRP entries, these PRP entries cannot be contained by the custom command due to the excessive number. Embodiments of the present application adopt Figure 3C The custom command format shown above, the field of the custom command does not directly contain the PRP entries corresponding to the PRPList itself, but records the index of the first PRP entry of the PRPList, determines the indexes of other PRP entries in the PRPList by the index of the first PRP entry, and indexes the corresponding PRP entries according to the indexes of the PRP entries. For example, the second PRP entry index of the PRPList = the first PRP entry index of the PRPList + 1, and the indexes of other PRP entries in the PRPList are obtained by analogy. The data and buf are recorded in the memory space indicated by other PRP entries (except the first PRP entry) in the PRPList. As Figure 3C The custom command format shown above can support the case that the PRPList includes more PRP entries. The above several custom command formats are acceptable by the electronic device and the storage device, and the storage device adopts different ways to parse the custom command of different formats.

[0126] In some embodiments, the electronic device and the storage device agree on a custom command format to be used. In other embodiments, in order to enable the storage device to identify which format is used for the custom command, a flag field is also carried in the custom command, which is used to indicate which format is used for the custom command. The storage device identifies the corresponding format based on the content recorded in the flag field, and further identifies the fields of the custom command. As an example, Figure 4A represents the format of the custom command provided by another embodiment of the present application, see Figure 4A , the value of the flag field in the custom command is flag0, indicating that the format of the custom command is Figure 3A as shown in the format; Figure 4B represents the format of the custom command provided by another embodiment of the present application, see Figure 4B , the value of the flag field in the custom command is flag1, indicating that the format of the custom command is Figure 3B as shown in the format; Figure 4C represents the format of the custom command provided by another embodiment of the present application, see Figure 4C , the value of the flag field in the custom command is flag2, indicating that the format of the custom command is Figure 3C as shown in the format.

[0127] Figure 5 A block diagram of the storage device supporting file system basic operations provided by an embodiment of the present application is shown. As an example, the storage device includes a control component, which, as shown in Figure 5 , 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 with an electronic device (e.g., a host or an FPGA device).

[0128] The storage device is coupled with the electronic device, and the host command processing unit receives the custom command carrying the file system basic operation sent by the electronic device through the host interface. After receiving the custom command carrying the file system basic operation, the host command processing unit forwards the file system basic operation carried by the custom command to the file system.

[0129] The file system generates one or more storage commands according to the type and file parameters of the file system basic operation, and provides the generated storage commands to the storage command processing unit. When processing the custom command carrying the file system basic operation provided by the electronic device, the control component provides the storage commands to the storage command processing unit by the file system, rather than as Figure 1BThe storage command processing unit processes the storage command. The storage medium management unit maintains the conversion of logical address to physical address for each storage command. The storage command processing unit generates a medium interface command according to the physical address provided by the storage medium management unit, and issues a storage medium access command to the NVM chip through the medium interface command by operating the medium interface controller. It should be understood that when the control component processes the custom command sent by the electronic device carrying the basic operation of the file system, the storage command processing unit, the storage medium management unit and the medium interface controller in the control component process similar to the process of processing the NVMe command sent by the host.

[0130] The storage command processing unit processes the storage command. The storage medium management unit maintains the conversion of logical address to physical address for each storage command. The storage command processing unit generates a medium interface command according to the physical address provided by the storage medium management unit, and issues a storage medium access command to the NVM chip through the medium interface command by operating the medium interface controller. It should be understood that when the control component processes the custom command sent by the electronic device carrying the basic operation of the file system, the storage command processing unit, the storage medium management unit and the medium interface controller in the control component process similar to the process of processing the NVMe command sent by the host.

[0131] For the storage device, the LBA space is divided into two parts, which are used to record the file system metadata and the file data, respectively. For example, a specified region of the LBA space records the file system metadata, which 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 of the file system metadata. For example, for the FAT file system, the file system metadata is the FAT table, which is located at the start and end positions of the LBA space; for the XFS file system, the file system metadata includes the superblock, inode (i-node), free space information, etc., which is located at the start position of the LBA space. And the organization mode / data structure of the file system data of different file systems is the same.

[0132] The following takes the FPGA device as an example to introduce the process of the electronic device accessing the storage device based on the custom command.

[0133] Figure 6 The schematic diagram of the FPGA device provided by the embodiment of the application accessing the storage device through the custom command is shown.

[0134] In the Figure 6 , the file system metadata is located at the start position of the LBA space. Referring to Figure 6The FPGA device generates a custom command carrying a file system basic operation, and sends the custom command to the storage device. The host command processing unit in the control component of the storage device receives the custom command through the host interface, and forwards the file system basic operation carried by the custom command to the file system in response to the custom command carrying the file system basic operation (e.g. based on the content of OP). The file system generates one or more storage commands according to the type of the file system basic operation and the file parameter in response to receiving the file system basic operation, processes the file system basic operation, and returns a processing result to the host command processing unit. The custom command carries at least OP and the file parameter, and when the custom command indicates a read file operation or a write file operation, the custom command further includes PRPList representing buf or dataf, and when the custom command indicates a list file operation, the custom command includes PRPList indicating buf.

[0135] For example, the custom command sent by the FPGA device carries fread(file_path_name, buf), which indicates a read file operation. Since the file data accessed by the custom command sent by the FPGA device corresponds to a path with multiple possibilities in length and a file system path with multiple possibilities in depth, the file system, after receiving fread(file_path_name, buf), issues one or more storage commands according to file_path_name to find and read an inode (denoted as inode_D) recording directories at each level of the file system path indicated by file_path_name in the file system metadata.

[0136] After obtaining inode_D recording the directories of the file to be read indicated by file_path_name, one or more inodes (denoted as inode_F) recording file data of the file to be read indicated by file_path_name are obtained according to inode_D. In the case of a large file, the file corresponds to multiple inode_F. The file system obtains LBA addresses of the file data stored in the LBA space based on inode_F, and generates one or more storage commands to read the file data.

[0137] For example, for fread (" / root / abc.txt", buf), first read the inode (inode_D) representing the root directory " / " by a store command, which is at a known location in the LBA space, and get the LBA address of the inode representing the directory "root" from the inode. Then read the inode (inode_D) representing the directory "root" by another store command, and get the LBA address of the inode (inode_F) representing the file "abc.txt" from the inode. Next, read the inode (inode_F) representing the file "abc.txt" by yet another store command, and get the LBA address of the storage location of the file data itself of the file "abc.txt" from the inode; then read the file data of the file "abc.txt" by further store commands. Optionally, when the file "abc.txt" is large, there are multiple inode_F's recording the LBA address of the storage location of the file data itself of the file "abc.txt".

[0138] Still as an example, the custom command fwrite (file_path_name, data) sent by the FPGA device indicates a write file operation. For fwrite (" / root / a.so", data), first read the inode (inode_D) representing the root directory " / " by a store command, which is at a known location in the LBA space, and get the LBA address of the inode representing the directory "root" from the inode. Then read the inode (inode_D) representing the directory "root" by another store command, and get the LBA address of the inode (inode_F) representing the file "a.so" from the inode. Next, read the inode (inode_F) representing the file "a.so" by yet another store command, and get the LBA address of the storage location of the file data itself of the file "a.so" from the inode; then write the file data of "a.so" by further store commands. Optionally, allocate new LBA space for the file "a.so" to accommodate more file data, the LBA address of the newly allocated LBA space is recorded in inode_F, and also write data to the newly allocated LBA address by a store command. Still optionally, if the original inode_F cannot accommodate more LBA addresses, allocate a new inode_F, and in addition to writing file data to the newly allocated LBA address by a store command, also write the newly allocated inode_F to the LBA space by a store command, which becomes part of the file system metadata.

[0139] The storage command generated by the file system is processed by the storage command processing unit. For example, for fwrite(file_path_name, data), the storage command processing unit, in response to the received storage command, determines the physical address (PPA) corresponding to the LBA carried by the 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 accessed is determined based on the physical address carried by the media interface command, a storage media access command is generated and sent to the corresponding logical unit to implement writing file data to the corresponding physical page.

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

[0141] For example, for fread(file_path_name, buf), the storage command processing unit, in response to the received storage command, determines the physical address (PPA) corresponding to the LBA carried by the 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 accessed is determined based on the physical address carried by the media interface command, a storage media access command is generated and sent to the corresponding logical unit to read the data in the physical page indicated by the PPA. The file system manages file system metadata and file data in the LBA space and is unaware of the physical address.

[0142] 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 PRPList, and generates a completion message and sends it to the FPGA device in response to the completion of processing of the custom command indicating the fread(file_path_name, buf) operation.

[0143] In another example, the custom command sent by the FPGA device carries flist(file_path), which indicates the operation of listing all files and directories under the specified file system path. For example, for flist(“ / root / Directory1”), first read the inode (inode_D) representing the root directory “ / ” through a storage command, which is located at a known location in the LBA space, and obtain the LBA address of the inode representing the directory “root” from the inode. Then read the inode (inode_D) representing the directory “root” through another storage command, and obtain the LBA address of the inode (inode_D) representing the directory “Directory1” from the inode. Next, read the inode (inode_D) representing the directory “Directory1” through another storage command, and record the LBA addresses of the inodes of all files and directories under the file system path “ / root / Directory1” in the inode, so as to list all files and directories under the file system path “ / root / Directory1”.

[0144] The above describes the cases where the custom command sent by the FPGA device carries fread(file_path_name, buf), fwrite(file_path_name, data), and flist(file_path). The custom command sent by the FPGA device to the storage device can also carry other information and indicate other types of operations, which are not listed and described here.

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

[0146] / root

[0147] / bin / foo.s

[0148] / dev / abc.txt

[0149] bar.dat

[0150] Wherein, / root, / bin, / 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 directory / bin, the abc.txt file is located in the directory / dev, and the bar.dat file is located in the directory / root.

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

[0152] It should be understood that when the electronic device provided by the embodiment of the present application is a host, the process of accessing the storage device by the host through the custom command is similar to the process of accessing the storage device by the FPGA device, which will not be described here.

[0153] After the electronic device writes the file data to the storage device based on the custom command, the file data written by the electronic device can be accessed by the electronic device to read the file data; in addition, the storage device can be coupled with other devices (target devices, such as hosts or FPGA devices) different from the electronic device that writes the file data, and the file data written by the electronic device can be read by the other devices. For example, the other devices different from the electronic device that writes the file data have a file system, and the other devices can access the storage device in a file system manner. After the electronic device writes the file data to the storage device based on the custom command, the other devices different from the electronic device that writes the file data can access the file data written by the electronic device through the file system. Hereinafter, the electronic device is taken as an FPGA device, and the other devices are taken as hosts, and the process of accessing the file data written by the electronic device by the other devices through the file system is introduced, which can be referred to in detail in Figure 7 .

[0154] Figure 7 The schematic diagram of the host provided by the embodiment of the present application accessing the storage device through the IO command.

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

[0156] The application running in the host issues file system basic operations to the file system running in the host for reading file data, the file system in the host issues one or more NVMe read commands to the storage device through, for example, the NVMe driver according to the received file system basic operations, the storage device processes the NVMe read commands in the prior art manner (see Figure 1B ), and provides the host with the read file data.

[0157] For the host, the file system basic operations are generated by running the application, the file system in the host determines the LBA where the file data to be operated is stored according to the file system path (file_path_name) of the file to be operated and the file system metadata in the file system basic operations. The file system sends the LBA to, for example, the NVMe driver, and generates the NVMe command based on the LBA by running the NVMe driver. The LBA space used by the file system of the storage device is consistent with the LBA space provided by the storage device to the host, so that the host can access the LBA space of the storage device through the NVMe command, so that the host can write data to the LBA space of the storage device through the NVMe command, and can also access the file data stored in the LBA space of the storage device.

[0158] As an example, the file system basic operation is fread(“ / root / bar.dat”, buf) indicating a read file operation, the file system in the host finds and reads the inode (inode_D) representing the root directory “ / ” in the file system metadata, reads the inode (inode_D) representing the directory “root” from the inode, and obtains the inode (inode_F) representing the file “bar.dat” from the inode, and obtains the LBA address representing the storage location of the file data itself of the file “bar.dat” from the inode, and sends the LBA to the NVMe driver. The NVMe driver generates an NVMe read command according to the LBA. The storage device receives the NVMe read command. The host command processing unit of the storage device receives the NVMe command, sends a corresponding storage command to the storage command processing unit, and the storage command processing unit reads the file data to be read from the LBA space of the storage device based on the LBA carried by the storage command, so as to realize reading the file data written by the FPGA device from the storage device based on the NVMe read command sent by the host.

[0159] As an example, the specific application scenario of the embodiments of the present application includes a first stage of writing file data by an FPGA device and a second stage of reading the file data written by the FPGA device by a host. The first stage occurs in a data acquisition site, and the FPGA device writes the acquired data to a storage device without the participation of the host. Thus, the FPGA device and the storage device can constitute a miniaturized or dedicated system processing system, which is deployed or applied in, for example, a field, a ship, a spacecraft, a factory, and the like, to write the acquired site data in the form of a file to the storage device in a high-speed and low-power manner. The second stage occurs in, for example, a data center or a laboratory for analyzing data. The laboratory has a host and the like, which is a fully functional and fully capable information processing device, to read the file data from the storage device and perform analysis.

[0160] In the first stage (a data acquisition and recording stage), the FPGA device is connected to the storage device, and the acquired site data is written to the storage device in the form of a file. The process of writing the file data by the FPGA device to the storage device is described above and will not be repeated here. Since the FPGA device does not need to implement a file system, its performance can be fully used for data acquisition and generation of custom commands, and a higher data throughput bandwidth can be achieved.

[0161] In the second stage, the storage device is disconnected from the FPGA device, and the storage device is connected to the host. The host reads the file data written by the FPGA device to the storage device in the form of an NVMe read command through a file system, and the storage device processes the NVMe read command sent by the host in the existing manner.

[0162] After the electronic device provided in the embodiments of the present application writes file data to the storage device in the form of a file, the LBA space of the storage device records file system metadata and file data. The organization mode / data structure of the file system metadata and the file data (collectively referred to as file system data) is the same as that of the file system data generated by a software form file system in another device (having a file system) different from the electronic device that writes the file data, so that the software form file system in the other device can directly identify the file system data of the storage device and mount it to a specified file system path of the other device (for example, a host) in the form of a directory. Thus, the other device accesses the file data written by the electronic device in the storage device in the form of a file system, and the other device generates an NVMe IO command in the prior art (for example, a software form file system running on the host and an NVMe driver) to access the file written by the electronic device in the storage device. When a user operates the other device to access the file written by the electronic device in the storage device, the user only needs to access the file in the form of the prior art file system, and the other device does not need to be modified.

[0163] It should be noted that the embodiments of the present application can be understood as follows: the electronic device sends a custom command carrying a file system basic operation to the storage device, the storage device processes the custom command to process the file system basic operation, and the electronic device accesses the storage device in the file system mode. After the electronic device writes file data to the storage device in the file system mode, other devices access the file data written by the electronic device to the storage device based on the file system through IO commands between the file system and the storage device, so that other devices can recognize and access the file data written by the electronic device to the storage device without modifying other devices.

[0164] Figure 8 The block diagram of the storage device provided by another embodiment of the present application is provided.

[0165] As an example, referring to Figure 8 , the control component of the storage device includes control circuit 801 and control circuit 802. The file system shown in Figure 5 and Figure 6 is loaded in the control circuit 802. The storage device is coupled with the electronic device (host or FPGA device). The electronic device can send NVMe command or NVMe VU command to the storage device to access the storage device. If the electronic device (such as host) sends NVMe command to the storage device to access NVM chip, the control circuit 801 processes the NVMe command; if the electronic device sends custom command to the storage device to access the storage device in the file system mode, the control circuit 801 and the control circuit 802 cooperate to process the custom command. It should be understood that the custom command sent by the electronic device to the storage device indicates a file system basic operation, and the electronic device controls the storage device to access the LBA space in the file system mode through the custom command.

[0166] In the case where the electronic device sends a custom command carrying a file system basic operation to the storage device, the host command processing unit of the control circuit 801 receives the custom command, sends the file system basic operation indicated by the custom command to the control circuit 802, and the file system loaded in the control circuit 802 generates a storage command carrying LBA according to the received file system basic operation, and sends it to the storage command processing unit in the control circuit 801. 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 accessed logical unit based on the physical address carried by the media interface command, determines the LUN controller corresponding to the accessed logical unit based on the mapping relationship between the logical unit and the LUN controller, processes the media interface command by the LUN controller, generates a storage media access command, and sends it to the corresponding logical unit.

[0167] In case the electronic device (e.g. host) sends NVMe commands to the storage device, the host command processing unit of the control circuit 801 receives the NVMe commands, sends corresponding storage commands to the storage command processing unit, and the storage command processing unit processes the storage commands, which are described above and will not be repeated here.

[0168] Figure 9 A block diagram of the storage device according to yet another embodiment of the present application.

[0169] As an example, as shown in Figure 9 The control components include a control circuit 901 and a control circuit 902, where the control circuit 901 includes a CPU group 1 and a media interface controller, and is configured 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 902 includes a CPU group 2, and is configured to process user specified operations or file system basic operations. The electronic device exchanges data with the control circuit 901 through a PCIe link. For example, when a user wants to access data in the NVM chip, the user generates an NVMe read command or an NVMe write command through the host, and sends the NVMe read command or the NVMe write command to the control circuit 901 through the PCIe link between the host and the control circuit 901. The host command processing unit, the storage command processing unit, the storage media management unit and the media interface controller in the control circuit 901 process the NVMe read command or the NVMe write command and access the NVM chip.

[0170] Continuing to refer to Figure 9 For example, the CPU group 1 includes four CPU cores, i.e. CPU 1-0, CPU 1-1, CPU 1-2 and CPU 1-3. Optionally, a real time operating system (RTOS) is run on the four CPU cores of the CPU group 1, and the CPU group 1 implements the host command processing unit, the storage command processing unit and the storage media management unit under the support of the operating system, and further provides functions such as managing the FTL table or garbage collection (GC). It can be understood that the implementation of the host command processing unit, the storage command processing unit and the storage media management unit can not depend on the operating system.

[0171] As an example, as shown in Figure 9As shown, the CPU group 2 includes four CPU cores, CPU 2-0, CPU 2-1, CPU 2-2, and CPU 2-3, and a standard operating system (e.g., Linux) runs on the four CPU cores of the CPU group 2. A remote connection tool (e.g., Secure Shell, SSH) and an application program are installed on the standard operating system, and a file system is installed on the standard operating system. The electronic device and the control circuit 902 communicate with each other via, for example, the SSH.

[0172] Figure 9 In the example of FIG. 1, the control circuit 901 and the control circuit 902 each include four CPU cores. Understandably, each control circuit can include other numbers of CPU cores, which can be the same as or different from each other. The number of CPU cores of each of the control circuit 901 and the control circuit 902 is not necessarily the same.

[0173] Still by way of example, when the host communicates with the operating system / application program in the control circuit 902, the communication can be via the PCIe link between the control circuit 901 and the host. For example, the host carries a communication or a call request for the control circuit 902 via a custom command compliant with the NVMe protocol, and the control circuit 901 forwards the communication or the call request to the control circuit 902, and the corresponding response from the control circuit 902 is returned to the host via the control circuit 901 as a response to the custom command.

[0174] Since the control circuit 902 runs a standard operating system, it is possible for a user rather than a provider of the control component to develop a program running in the control circuit 902 based on the standard operating system. Even without assistance from the provider of the control circuit 902, the user can develop the program running in the control circuit 902 using development tools of the existing art and / or development tools provided by the provider of the control component. Such a program can not only call services of the standard operating system via an API, but also use storage device services based on, for example, the NVMe protocol provided by the control circuit 901, and when using the storage device services, the transmission path of data read and written is within the storage device without being transmitted to the outside of the storage device via the PCIe link, so that the data throughput exceeds the bandwidth provided by the PCIe link and the processing delay is lower.

[0175] The hardware accelerator of the control circuit 902 can also be used by the program running in the control circuit 902 developed by the user. The hardware accelerator is operated by the application program developed by the user as a device compatible with the standard operating system via the standard operating system, the hardware abstraction layer, and / or the board support package (BSP).

[0176] The standard operating system in the control circuit 902 is loaded with a file system (e.g., 5 and Figure 6The storage device can process not only the NVMe commands sent by the host, but also custom commands indicating file system basic operations, and the storage device processes the custom commands in a file system manner to access file data indicated by the custom commands to be accessed. The host command processing unit in the control circuit 901 receives the custom commands carrying file system basic operations sent by the FPGA device, for example, and the host command processing unit forwards the file system basic operations carried by the custom commands to the file system of the control circuit 902 in response to the custom commands carrying the file system basic operations. The file system generates one or more storage commands in response to receiving the file system basic operations, and the storage commands are provided to the storage command processing unit in the control circuit 901, which obtains the PPA provided by the storage medium management unit (the PPA corresponding to the LBA carried by the storage command) and provides the PPA to the medium interface controller in the form of a medium interface command. The subsequent processing process is performed by the medium interface controller.

[0177] In addition, the host can also send custom commands (not carrying file system basic operations) to the storage device to access the storage device, for example, the host instructs the user to specify operations to control the storage device to perform the user-specified operations through the custom commands. For another example, the host can also send custom commands carrying file system basic operations to instruct the file system basic operations to access the storage device in a file system manner. In Chinese patents with application numbers CN2023112835330 and CN2023112872541, the control components, the interaction process between the host and the storage device, and the process of the host accessing the storage device through custom commands are introduced, and the contents are incorporated herein. The process of the electronic device accessing the storage device to implement the RAID function based on the custom commands provided by the embodiments of the present application is introduced below.

[0178] Figure 10 A schematic diagram of an electronic device provided by an embodiment of the present application accessing two storage devices to implement RAID1 through custom commands is shown.

[0179] As an example, in the Figure 10 hard RAID mode is used to implement the RAID1 function. Figure 10The system includes an electronic device, a RAID module and two storage devices (storage device 1 and storage device 2); for example, the RAID module is a hardware module outside the electronic device, which is a RAID control processing chip for implementing RAID functions in a hardware RAID manner, such as a RAID card, a RAID chip integrated on a motherboard, etc. The electronic device and the RAID module are connected through a PCIe link, and the RAID module and the two storage devices are connected through a PCIe link. The storage device 1 is a working storage device; the storage device 2 is a mirror storage device of the storage device 1, used for backing up data in the storage device 1. Since the RAID module is outside the electronic device, the electronic device cannot perceive the RAID module.

[0180] For example, the electronic device generates a custom command (NVMe VU command) indicating a file system basic operation. The file system basic operation carried by the custom command is a write file operation fwrite(file_path_name, data), and the electronic device sends the custom command to the RAID module through the PCIe link; the RAID module responds to receiving the custom command, and copies the custom command to obtain custom command 1 (NVMe VU command 1) and custom command 1' (NVMe VU command 1'); wherein, the custom command 1 and the custom command 1' are exactly the same, for example, carrying the same file system basic operation, having the same format, etc. In addition, the file system basic operation carried by the custom command 1 and the custom command 1' is the same as the file system basic operation carried by the custom command sent by the electronic device to the RAID module, which is the write file operation fwrite(file_path_name, data).

[0181] The RAID module sends the custom command 1 to the storage device 1 and the custom command 1' to the storage device 2, respectively. The storage device 1 processes the custom command 1, and writes data to the file system path and file name indicated by file_path_name according to the write file operation fwrite(file_path_name, data) indicated by the custom command 1. The storage device 2 processes the custom command 1', and writes data to the file system path and file name indicated by file_path_name according to the write file operation fwrite(file_path_name, data) indicated by the custom command 1'. Since the custom command 1 and the custom command 1' are also exactly the same, the file data written by the storage device 1 processing the custom command 1 is exactly the same as the file data written by the storage device 2 processing the custom command 1', thereby realizing the function of RAID 1.

[0182] For another example, the basic file system operation indicated by the custom command generated by the electronic device is the file read operation fread(file_path_name, buf). The electronic device sends the custom command to the RAID module through the PCIe link. After receiving the custom command, the RAID module does not copy the custom command, but sends the received custom command to storage device 1. Storage device 1 processes the custom command and reads the corresponding file data from storage device 1 according to the file read operation fread(file_path_name, buf) indicated by the custom command. In response to the error in the file data read from storage device 1 based on the custom command, the RAID module copies the custom command to obtain custom command 1", where custom command 1" is exactly the same as the custom command. The RAID module sends custom command 1" to storage device 2. Storage device 2 processes custom command 1" and reads the backed-up file data from storage device 2. In response to the error in the file data read from storage device 1 based on the custom command, the RAID module completes the custom command processing. For either storage device 1 or storage device 2, the control component of the storage device and Figure 9 The process of the control component in storage device 1 processing the custom command 1 or the control component in storage device 2 processing the custom command 1' is similar to that shown in FIG. Figure 9 , which will not be elaborated here. The above content describes, by way of example, the process by which a storage device processes a custom command indicating a file write operation and a custom command indicating a file read operation. When processing the custom command indicating a file write operation, the RAID module copies the custom command issued by the electronic device to obtain two identical custom commands. These two identical custom commands are then sent to the two storage devices. Based on the received custom commands, the two storage devices store the same data in their respective storage devices, thereby backing up the data and achieving the high storage reliability of RAID1.

[0183] It should be understood that Figure 10 The RAID module shown may also be located inside the electronic device and is a hardware module inside the electronic device, which is not limited here.

[0184] Figure 11 A schematic diagram showing another embodiment of the present application showing an electronic device accessing two storage devices through custom commands to implement RAID1.

[0185] As an example, in Figure 11 The soft RAID method is used to implement the RAID1 function. Figure 11The system includes an electronic device and two storage devices (storage device 1 and storage device 2), wherein storage device 1 is used as a working storage device, and storage device 2 is used as a mirror storage device of storage device 1 to back up data in storage device 1. Storage device 1 includes a file system 1, and storage device 2 includes a file system 2, and the file system 1 and the file system 2 are two independent file systems. In addition, the file system 1 and the file system 2 can have the same structure or different structures. The electronic device includes an application program, a RAID module, and an NVMe drive circuit, and the RAID module is, for example, a software inside the electronic device. A file system basic operation is generated in the electronic device by running an application program (APP). The application program sends the generated file system basic operation to the RAID module in response to the file system basic operation. The RAID module obtains the file system basic operation, and in response to the file system basic operation being a write file operation, the RAID module obtains the same file system basic operation 1 and file system basic operation 1' by copying the file system basic operation, and sends the file system basic operation 1 and the file system basic operation 1' to the NVMe drive circuit. The NVMe drive circuit generates a custom command 1 (NVMe VU command 1) carrying the file system basic operation 1 and a custom command 1' (NVMe VU command 1') carrying the file system basic operation 1', and the custom command 1 is the same as the custom command 1', and the custom command 1 is sent to the storage device 1 and the custom command 1' is sent to the storage device 2. The storage device 1 processes the custom command 1 to access an LBA space 1, and the storage device 2 processes the custom command 1' to access an LBA space 2, wherein the LBA space 1 is an LBA space managed by the storage device 1, the LBA space 2 is an LBA space managed by the storage device 2, and the LBA space 1 and the LBA space 2 are two independent LBA spaces. The process of the storage device processing the custom command carrying the file system basic operation is described above and will not be described here. By sending the same NVMe VU command to the storage device 1 and the storage device 2, the storage device 1 and the storage device 2 have the same file system structure (the file system data managed by the file system is the same), and the data backup is realized.

[0186] When one of the two storage devices fails, the file system data of the storage device that does not fail can be moved to a new storage device through a file copy operation of the file system, and accessed to the RAID module (without copying the entire LBA space or the entire PPA space), and the RAID module can continue to operate the two storage devices normally in the RAID1 mode.

[0187] As an example, when the storage device 1 fails, the failed storage device 1 is replaced with a new storage device 3, the file system data of the storage device 2 is copied to the storage device 3, and the storage device 3 is connected to the RAID module, the storage device 3 and the storage device 2 can continue to work in the RAID 1 mode, thereby realizing high reliability.

[0188] In practical applications, in addition to the demand for high-reliability storage, the demand for large-capacity storage is also increasing. In order to meet the demand for large-capacity storage, the system provided by the embodiment of the present application includes an electronic device, a RAID module (such as located inside or outside the electronic device) and two storage devices (storage device 1 and storage device 2). Without changing the structure of the system, in addition to realizing the RAID 1 function, the RAID 0 function can also be compatible. According to actual needs, the RAID 1 function and the RAID 0 function can be switched between each other.

[0189] Figure 12 A schematic diagram for realizing the RAID 0 function provided by an embodiment of the present application is shown.

[0190] As an example, in the system structure shown in Figure 12 , the RAID 0 function is realized by using the soft RAID mode. Figure 12 The system structure is the same as that shown in Figure 11 , which also includes an electronic device and two storage devices (storage device 1 and storage device 2). The storage device 1 includes a file system 1, and the storage device 2 includes a file system 2. The file system 1 and the file system 2 are two independent file systems. In addition, the structures of the file system 1 and the file system 2 can be the same or different. The electronic device includes an application program, a RAID module and an NVMe driving circuit. The RAID module is, for example, a software inside the electronic device. In the electronic device, the application program (APP) generates a file system basic operation 1 for accessing the file system 1 and a file system basic operation 2 for accessing the file system 2. The file system basic operation 1 and the file system basic operation 2 can be different or the same. The application program sends the generated file system basic operation 1 and the file system basic operation 2 to the RAID module. The RAID module obtains the file system basic operation 1 and the file system basic operation 2, and sends the file system basic operation 1 and the file system basic operation 2 to the NVMe driving circuit, respectively. The NVMe driving circuit generates a custom command A carrying the file system basic operation 1 and a custom command B carrying the file system basic operation 2, and sends the custom command A to the storage device 1 and the custom command B to the storage device 2, respectively. The storage device 1 processes the custom command A, and the storage device 2 processes the custom command B. The process of the storage device processing the custom command carrying the file system basic operation is described above, which will not be described here.

[0191] For example, the file system basic operation 1 indicates writing file data 1, and the file system basic operation 2 indicates writing file data 2, where the file data 1 and the file data 2 are different file data, the storage device 1 processes the custom command A to write the file data 1 to the LBA space 1 corresponding to the storage device 1, and the storage device 2 processes the custom command B to write the file data 2 to the LBA space 2 corresponding to the storage device 2. Based on this, without changing the system structure for implementing the RAID 1 function, different file data can be written into the storage device 1 and the storage device 2 based on the system, so as to implement the utilization of the storage spaces of the storage device 1 and the storage device 2, and further implement the RAID 0 function and large-capacity storage.

[0192] It should be understood that the file system structures managed by the file system 1 of the storage device 1 and the file system 2 of the storage device 2 can be different; or can have the same file system structure, for example, all file system basic operations for accessing the file system 1 and the file system 2 issued by the application program are the same.

[0193] Figure 13 A schematic diagram for implementing the RAID 0 function is shown.

[0194] As an example, in the case of Figure 13 The RAID 0 function is implemented in a hard RAID manner. Figure 13 The electronic device, the RAID module and two storage devices (the storage device 1 and the storage device 2) are included in the case. For example, the RAID module is a hardware module located outside the electronic device, which is a RAID control processing chip for implementing the RAID function in a hard RAID manner, such as a RAID card, a RAID chip integrated on a mainboard, etc. The electronic device and the RAID module are connected through a PCIe link, and the RAID module and the two storage devices are connected through a PCIe link. Since the RAID module is located outside the electronic device, the electronic device cannot perceive the RAID module.

[0195] For example, the electronic device generates the custom command A (NVMe VU command A) indicating the file system basic operation 1 and the custom command B (NVMe VU command B) indicating the file system basic operation 2, where the file system basic operation 1 and the file system basic operation 2 can be different or the same. The electronic device sends the custom command A and the custom command B to the RAID module through the PCIe link; the RAID module sends the custom command A to the storage device 1 and the custom command B to the storage device 2 in response to receiving the custom commands. The storage device 1 processes the custom command A, and the storage device 2 processes the custom command B, so as to implement the access to the two storage devices based on the two custom commands.

[0196] In the case that the file system basic operation 1 is different from the file system basic operation 2, different custom commands are sent to the two storage devices, so that the file system data of the two storage devices have differences, different data can be stored by using different storage devices, and large capacity storage is realized.

[0197] While the preferred embodiments of the application have been described, additional variations and modifications can be made to the preferred embodiments by those skilled in the art once they learn of the basic inventive concepts. Therefore, the appended claims are intended to encompass within their scope all possible variations and modifications of the preferred embodiments. It is apparent that those skilled in the art can, without departing from the spirit or scope of the application, make various changes and modifications of the application. Thus, the application is intended to encompass all such changes and modifications as fall within the scope of the claims, and their equivalents.

Claims

1. A method of accessing a storage device, the method comprising: The method is applied to an electronic device coupled with a first storage device and a second storage device and without a file system function, and comprises: In response to a first file system basic operation indicating a write file operation, generating a first custom command and a second custom command carrying a file system basic operation and complying with an NVMe protocol; Sending the first custom command to the first storage device and the second custom command to the second storage device to access a first logical address space managed by the first storage device and a second logical address space managed by the second storage device; Wherein, the first custom command and the second custom command both carry the first file system basic operation.

2. The method of claim 1, wherein, Further comprising: In response to a first file system basic operation indicating a write file operation, generating a third custom command carrying the first file system basic operation and complying with an NVMe protocol; In response to a second file system basic operation indicating a write file operation, generating a fourth custom command carrying the second file system basic operation and complying with an NVMe protocol; Sending the third custom command to the first storage device and the fourth custom command to the second storage device to access a first logical address space managed by the first storage device and a second logical address space managed by the second storage device.

3. The method according to claim 1 or 2, characterized in that, Wherein, The first custom command is generated based on the first file system basic operation, and the second custom command identical to the first custom command is obtained by copying the first custom command; Or, The first file system basic operation is copied to obtain a third file system basic operation identical to the first file system basic operation, and the first custom command and the second custom command identical to the first custom command are generated based on the first file system basic operation and the third file system basic operation.

4. The method of claim 2, wherein, In response to the first file system basic operation and the second file system basic operation being identical file system basic operations, the third custom command and the fourth custom command carry identical file system basic operations; Or In response to the first file system basic operation and the second file system basic operation being different file system basic operations, the third custom command and the fourth custom command carry different file system basic operations.

5. The method of any one of claims 1 to 4, wherein, In response to the first custom command and the second custom command carrying the same file system basic operation, the same file data is written into the first logical address space of the first storage device and the second logical address space of the second storage device based on the first custom command and the second custom command respectively.

6. The method of claim 2 or 4, wherein, In response to the third custom command and the fourth custom command carrying different file system basic operations indicating a write file operation, different file data are written to a first logical address space of the first storage device and a second logical address space of the second storage device based on the third custom command and the fourth custom command respectively.

7. The method according to any one of claims 1 to 6, characterized in that, The first logical address space and the second logical address space are independent logical address spaces; the first storage device manages file data written to the first logical address space through a first file system, and the second storage device manages file data written to the second logical address space through a second file system.

8. The method of any one of claims 1-7, wherein, In response to sending the first custom command to the first storage device and sending the second custom command to the second storage device, the second storage device is a mirror storage device of the first storage device.

9. The method of claim 8, wherein, In response to generating a fourth file system basic operation of a read file operation, a fifth custom command is generated, the fifth custom command carrying the fourth file system basic operation and complying with the NVMe protocol, and the fifth custom command is sent to the first storage device; In response to the first storage device failing and the data failing to be read based on the fifth custom command, a sixth custom command is generated, the sixth custom command carrying the fourth file system basic operation and complying with the NVMe protocol, and the sixth custom command is sent to the second storage device to read file data corresponding to the fourth file system basic operation from the second storage device based on the sixth custom command. The electronic device includes an application program, an NVMe drive circuit, and a RAID module; 10. An electronic device, comprising: The application program generates a first file system basic operation indicating a write file operation; The NVMe drive circuit cooperates with the RAID module to generate a first custom command and a second custom command carrying the first file system basic operation and complying with the NVMe protocol; The NVMe drive circuit or the RAID module sends the first custom command to a first storage device and sends the second custom command to a second storage device to access a first logical address space of the first storage device and a second logical address space of the second storage device. ​