Method, device and equipment for executing file operation, medium and program product
By using file identifiers to convey file semantics in a key-value file system, the problem of the file system not being able to fully utilize SSD performance is solved, achieving efficient file operation management and improving processing efficiency and user experience.
Patent Information
- Application Number
- CN202410619526.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-17
- Publication Date
- 2025-11-18
AI Technical Summary
Existing file systems exhibit low throughput and low scalability when faced with improved storage device performance, especially solid-state drives (SSDs) with non-volatile memory host controller interface specifications. They cannot fully utilize SSD performance and become a bottleneck in the host-side software stack. At the same time, key-value SSDs bear a huge burden when managing large amounts of data keys.
By using file identifiers in the key-value file system to convey file semantics, converting them into key-value operations, and managing data on the storage device side in a file system manner, the use of storage, computing, and transmission resources is reduced, and file operations are performed using communication commands that support key-value semantics.
It improves the efficiency of file operations, reduces the use of storage and computing resources, enhances the user experience, simplifies metadata management, reduces the number of input/output requests, and improves data processing efficiency.
Smart Images

Figure CN120973750A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application mainly relate to the field of file systems. More specifically, embodiments of the present application relate to methods, apparatuses, devices, media and program products for performing file operations. BACKGROUND
[0002] A file system is a part of an operating system responsible for managing and accessing file information, and is an interface between the operating system and storage devices (such as hard disks, flash memories, etc.), providing a unified and abstract way for users and application programs to access and manage data. It is a system that implements file organization, management and access, aiming to provide users with a convenient file operation experience and protect files to ensure data security and reliability.
[0003] In addition, a file system also has the ability to organize and allocate space on a file storage device, and is responsible for the storage, protection and retrieval of files. It ensures that the physical layout of files on the storage device is reasonable to improve data access speed. At the same time, the file system also provides backup and recovery functions for data to prevent accidents. Therefore, the file system is a crucial part of the operating system. With the development of storage technology, the file system is also evolving to adapt to new storage medium characteristics and security requirements. However, there are still many problems to be solved in the application of file systems. SUMMARY
[0004] Embodiments of the present application provide a scheme for performing file operations.
[0005] According to a first aspect of the present application, a method for performing file operations is provided. The method comprises obtaining an operation request for a target file, the operation request comprising a file identifier related to the target file; and providing a communication command for a key-value operation in a key-value file system to a storage device to perform the operation on the target file using the file identifier, the key in the key-value operation comprising the file identifier.
[0006] In this way, the file identifier is placed in the key of the key-value file system and passed to the storage device through the key, so that the file semantics are passed through the transmission of the key value, enabling the storage device to store and manage data in the manner of a file system, reducing the use of storage resources, computing resources and transmission resources, improving processing efficiency and improving user experience.
[0007] In some embodiments, if the operation request is for metadata of the target file, the file identifier is an identifier of a parent directory of the target file; and if the operation request is for data of the target file, the file identifier is an identifier of the target file. In this way, the file identifier to be used can be quickly and accurately determined.
[0008] In some embodiments, the key is a metadata key for the target file, and the key comprises an identification of a parent directory and a file name of the target file. In this way, the metadata key for the metadata of the file can be determined quickly and accurately.
[0009] In some embodiments, the key is a data key for the target file, and the key comprises an identification of the target file and an identification of a data page where the data to be operated is located. In this way, the data key for the data of the file can be determined quickly and accurately.
[0010] In some embodiments, wherein the communication command for the key-value operation in the key-value file system is provided to the storage device to perform the operation on the target file using the file identification comprises: based on the key, converting the operation on the target file into a key-value operation for the key-value file system, the key-value operation comprising the file identification and a type of the operation; encapsulating the key-value operation into the communication command supporting key-value semantics; and providing the communication command to the storage device to perform the operation on the target file using the file identification. In this way, the file semantics can be quickly passed to the storage device using the communication command supporting key-value semantics.
[0011] In some embodiments, the communication command supports key-value operations on multiple data pages of the target file. In this way, the passing of the operations on the multiple data pages can be quickly implemented.
[0012] In some embodiments, the multiple data pages are continuous, and the communication command comprises an identification of a starting page of the multiple data pages and a number of the multiple data pages. In this way, the passing of the operations on the continuous multiple data pages can be quickly implemented.
[0013] According to a second aspect of the present application, a method for performing a file operation is provided. The method comprises receiving a communication command for a key-value operation in a key-value file system, a key in the key-value operation comprising a file identification related to a target file to be operated; and based on the file identification, performing the operation on the target file.
[0014] In this way, the file identification is obtained by receiving the communication command supporting key-value semantics, so that the file semantic information can be obtained from the command, so that the storage device performs the corresponding operation in the manner of the file system after obtaining the file identification, reducing the use of storage resources, computing resources and transmission resources, improving processing efficiency and improving user experience.
[0015] In some embodiments, wherein based on the file identification, the operation on the target file is performed comprises: obtaining a value corresponding to the key in the key-value operation; and based on the file identification and the value, performing the operation on the target file. In this way, the corresponding operation on the file can be quickly performed.
[0016] In some embodiments, if the file identifier is the identifier of the parent directory of the target file and its value is the metadata of the target file, then the operation is applied to the metadata of the target file; and if the file identifier is the identifier of the target file and its value is the data of the target file, then the operation is applied to the data of the target file. This method allows for a quick determination of whether the operation is applied to the file's metadata or its data.
[0017] In some embodiments, the target file's metadata and data are stored in different partitions. This approach, by storing data and metadata in different partitions, allows for more rational and efficient file management.
[0018] In some embodiments, the communication command includes an identifier of the data page and the number of data pages, and the operation is applied to multiple consecutive data pages starting with the first data page. This method enables rapid storage and management of multiple data pages, improving data processing efficiency.
[0019] According to a third aspect of this application, an apparatus for performing file operations is provided. The apparatus includes: an operation request acquisition unit configured to receive a communication command for a key-value operation in a key-value file system, wherein the key in the key-value operation includes a file identifier associated with a target file being operated on; and a communication command providing unit configured to provide the communication command for the key-value operation in the key-value file system to a storage device to perform an operation on the target file using the file identifier, wherein the key in the key-value operation includes the file identifier.
[0020] In some embodiments, if the operation request is for the metadata of the target file, the file identifier is the identifier of the parent directory of the target file; and if the operation request is for the data of the target file, the file identifier is the identifier of the target file.
[0021] In some embodiments, the key is a metadata key for the target file, and the key includes the identifier of the parent directory and the filename of the target file.
[0022] In some embodiments, the key is a data key for the target file, and the key includes an identifier of the target file and an identifier of the data page where the data to be operated is located.
[0023] In some embodiments, the communication command provider includes: an operation conversion unit configured to convert operations on a target file into key-value operations for a key-value file system, the key-value operations including a file identifier and an operation type; an encapsulation unit configured to encapsulate the key-value operations into a communication command that supports key-value semantics; and a first providing unit configured to provide the communication command to a storage device to perform operations on the target file using the file identifier.
[0024] In some embodiments, the communication commands support key-value operations on multiple data pages of the target file.
[0025] In some embodiments, the multiple data pages are contiguous, and the communication command includes an identifier of the starting page of the multiple data pages and the number of the multiple data pages.
[0026] According to a fourth aspect of this application, an apparatus for performing file operations is provided. The apparatus includes: a communication command receiving unit configured to receive a communication command for a key-value operation in a key-value file system, wherein the key in the key-value operation includes a file identifier associated with the target file being operated on; and an operation execution unit configured to perform an operation on the target file based on the file identifier.
[0027] In some embodiments, the operation execution unit includes: a value acquisition unit configured to acquire a value corresponding to a key in a key-value operation; and a first execution unit configured to perform an operation on a target file based on a file identifier and a value.
[0028] In some embodiments, if the file identifier is the identifier of the parent directory of the target file and the value is the metadata of the target file, then the operation is performed on the metadata of the target file; and if the file identifier is the identifier of the target file and the value is the data of the target file, then the operation is performed on the data of the target file.
[0029] In some embodiments, the metadata and data of the target file are stored in different partitions.
[0030] In some embodiments, the communication command includes an identifier of a data page and the number of data pages, and the operation is directed at multiple consecutive data pages starting from a data page.
[0031] According to a fifth aspect of this application, an electronic device is also provided, comprising: at least one computing unit; at least one memory coupled to the at least one computing unit and storing instructions for execution by the at least one computing unit, wherein, when executed by the at least one computing unit, the instructions cause the device to perform a method according to a first or second aspect of this application.
[0032] According to a sixth aspect of this application, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the method described according to the first or second aspect of this application.
[0033] According to a seventh aspect of this application, a computer program product is also provided, including computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the method described according to a first or second aspect of this application.
[0034] Understandably, the apparatus of the third aspect, the apparatus of the fourth aspect, the electronic device of the fifth aspect, the computer storage medium of the sixth aspect, or the computer program product of the seventh aspect provided above are used to perform the method provided by the first or second aspect. Therefore, the explanations or descriptions regarding the first or second aspect also apply to the third, fourth, fifth, sixth, and seventh aspects. Furthermore, the beneficial effects achievable by the third, fourth, fifth, sixth, and seventh aspects can be referred to the beneficial effects in the corresponding methods, and will not be repeated here. Attached Figure Description
[0035] The above and other features, advantages and aspects of the embodiments of this application will become more apparent when taken in conjunction with the accompanying drawings and the following detailed description.
[0036] In the accompanying drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0037] Figure 1 A schematic diagram illustrates an example environment in which several embodiments of this application can be implemented;
[0038] Figure 2 A schematic diagram illustrating an example of a system framework according to some embodiments of this application is shown;
[0039] Figure 3 A schematic diagram illustrating examples of metadata keys and data keys according to some embodiments of this application is shown;
[0040] Figure 4 A schematic diagram illustrating an example process for converting file operations into key-value operations according to some embodiments of this application is shown;
[0041] Figure 5 A schematic diagram illustrating examples of commands representing multiple access spaces according to some embodiments of this application is shown;
[0042] Figure 6 A schematic diagram illustrating an example of a driver supporting key-value semantics according to some embodiments of this application is shown;
[0043] Figure 7 The diagram illustrates example operation processes of key-value file system input / output (IO) and conventional file system IO according to some embodiments of this application;
[0044] Figure 8 A schematic diagram illustrating an example of the number of I / Os issued according to some embodiments of this application is shown;
[0045] Figure 9A schematic flowchart of a method for performing file operations according to some embodiments of this application is shown;
[0046] Figure 10 A schematic flowchart of another method for performing file operations according to some embodiments of this application is shown;
[0047] Figure 11 A block diagram of an apparatus for performing file operations according to some embodiments of this application is shown;
[0048] Figure 12 A block diagram of another apparatus for performing file operations according to some embodiments of this application is shown; and
[0049] Figure 13 A block diagram of a computing device capable of implementing several embodiments of the present application is shown. Detailed Implementation
[0050] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While some embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this application. It should be understood that the drawings and embodiments of this application are for illustrative purposes only and are not intended to limit the scope of protection of this application.
[0051] In the description of embodiments of this application, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0052] As mentioned above, many problems still need to be addressed in file systems. For example, with the rapid development of storage technology, storage device performance has greatly improved, such as solid-state drives (SSDs) based on the Non-Volatile Memory Express (NVMe) host controller interface specification. This trend has made the host-side file system a performance bottleneck. In some experiments, six SSDs with different performance levels were used to test the fourth-generation extended file system (EXT4). The tests revealed that in metadata-intensive scenarios, the EXT4 file system exhibited consistently low throughput and low scalability on SSDs with varying performance levels, failing to fully utilize the high throughput performance of SSDs. Further research also found that the EXT4 file system accounted for 32% of the total processing time, becoming a major bottleneck in the host-side software stack. Meanwhile, the performance of a flash-friendly file system (F2FS) was tested in a similar hardware and software environment, revealing that F2FS, like EXT4, faces the problem of not fully utilizing SSD performance.
[0053] To address the aforementioned issues, improved schemes such as Key-Value File System (KVFS) and Key-Value Solid State Drive (KVSSD) have been proposed. In this scheme, KVFS uses a key-value (KV) pair representation to convert various file operations (such as create / delete / read / write / rename) into key-value operations (get / set / delete / traverse), and then sends the converted key-value pairs to the KVSSD for processing. This simplifies the metadata of the traditional file system, reduces metadata management overhead, and also reduces the number of I / O requests issued by the file system, as well as the time spent by the file system on the host side. KVSSD can manage and store the key-value pairs issued by KVFS. Typically, KVSSD uses a traditional log-structured merge tree (LSM-tree) to manage the KV pairs. While LSM-trees offer excellent write performance, they cannot handle the management overhead of a large number of data keys. Furthermore, LSM-trees themselves suffer from read amplification, merge sort, and garbage collection performance overhead. When using key-value pairs to represent metadata and data, for metadata, one file corresponds to one metadata key-value pair; for data, each 4KB data page corresponds to one data key-value pair. For example, if a file is 16KB in size, it requires one metadata key-value pair and four data key-value pairs to represent it. Since each 4KB data page corresponds to one data key-value pair, KVSSD cannot handle the management burden of a large number of data key-value pairs. For example, a 1GB file requires 260,000 data key-value pairs; a 1TB capacity requires managing 260 million data key-value pairs. Such a large number of data key-value pairs undoubtedly presents a huge management burden and challenge in terms of link transmission, storage space, index traversal, and swapping in and out.
[0054] To address at least some of the aforementioned problems and other potential issues, in embodiments of this application, a computing device can obtain an operation request for a target file. This operation request includes a file identifier associated with the target file. The computing device can further generate a key, including the file identifier, that can be used in a key-value file system. Next, the computing device provides communication commands for key-value operations in the key-value file system to the storage device to perform operations on the target file using the file identifier. In this way, by placing the file identifier in the key of the key-value file system and passing the file identifier to the storage device via the key, file semantics are transferred using key-value semantics. This allows the storage device to store and manage data using a file system approach, reducing the use of storage, computing, and transmission resources, improving processing efficiency, and enhancing the user experience.
[0055] Figure 1 A schematic diagram of an example environment 100 in which various embodiments of this application can be implemented is shown. For example... Figure 1 As shown, example environment 100 includes computing device 102, which stores the data of files presented to the user by a virtual file system in storage device 104. Computing device 102 includes, but is not limited to, in-vehicle computing devices, personal computers, servers, handheld or laptop devices, mobile devices, multiprocessor systems, consumer electronics, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices.
[0056] A virtual file system 106 runs on computing device 102. The virtual file system is an abstraction layer of the operating system kernel, providing a unified interface for upper-level applications and user space to access various types of physical file systems. The main function of the virtual file system is to hide the complexity of the underlying file system, enabling the operating system to seamlessly support multiple file system formats, such as key-value file systems (KVFS) 108, EXT4, F2FS, etc., without requiring each application to understand and adapt to the details of each specific file system. The virtual file system defines a series of standard operation interfaces; any file system conforming to the virtual file system interface specification can be recognized and used by the operating system. The virtual file system provides an operating system-level file system abstraction.
[0057] Simultaneously, a key-value file system 108 runs on the computing device 102. The key-value file system can be used to implement a virtual file system to achieve file system functionality. For example, the key-value file system 108 can serve as a lower-level application of the virtual file system to implement its functionality. It organizes and stores data in the form of key-value pairs. In KVFS, each data item consists of a key and a value, and users can quickly retrieve and access the corresponding value using the key.
[0058] To preserve semantic information about the target file when operations are performed on it within the virtual file system 106, the virtual file system 106 can pass the file identifier 110 corresponding to the target file and related operation information to the key-value file system 108 via an operation request. After obtaining some operation information about the target file in the virtual file system, the key-value file system 108 converts the file operations into corresponding key-value operations. At this time, the key-value file system generates a key 112 for the key-value operation. When generating key 112, the computing device places the file identifier obtained from the virtual file system into key 112.
[0059] In some embodiments, when operating on the metadata of a target file in the virtual file system, the operation request may also include the identifier of the parent directory of the target file to be processed. Therefore, the key-value file system 108 can obtain the file identifier from the virtual file system 106 as the identifier of the parent directory of the target file to be processed. Additionally, the key-value file system also obtains the filename of the target file from the operation request to generate key 112. For example, when creating or deleting a file, the virtual file system needs to provide the identifier of the parent directory and the filename of the target file to the key-value file system. Then, the key-value file system uses the obtained identifier of the parent directory and the filename of the target file to generate a metadata key.
[0060] In some embodiments, when operating on data of a target file in a virtual file system, the generated operation request includes an identifier of the target file to be processed. Therefore, the file identifier obtained by the key-value file system 108 from the virtual file system 106 is the identifier of the target file to be processed. Additionally, the key-value file system 108 also obtains the identifier of the page containing the data to be processed. For example, when modifying or reading data from a target file, the identifier of the target file to be modified or read and the identifier of the data page containing the data need to be provided to the key-value file system. The key-value file system then uses the obtained file identifier and data page identifier to generate a data key.
[0061] The computing device 102 then provides the generated key and the corresponding data to the storage device 104. This allows the file identifier in the key, along with other information passed to the storage device, to be used to implement file semantics within the storage device. This enables data storage on the storage device side using a file system approach, eliminating the need for key-value data storage. The storage device 104 can include any storage device that can be connected to the computer 102, including but not limited to hard disk drives, solid-state drives, USB flash drives, memory cards, network attached storage (NAS), etc. Figure 1 The illustration shows a storage device 104 disposed outside the computing device 102, which is merely an example and not a specific limitation of this disclosure. In some embodiments, the storage device 104 may be disposed within the computing device 102. Additionally, the storage device has a processor for processing commands from the computing device 102.
[0062] This method places the file identifier of the virtual file system in the key of the key-value file system and passes the file identifier to the storage device through the key. In this way, the file semantics are passed through the key-value transfer, so that the storage device can store and manage data in the manner of a file system. This reduces the use of storage resources, computing resources and transmission resources, improves processing efficiency and enhances user experience.
[0063] The above combination Figure 1 A schematic diagram illustrating an example environment 100 in which embodiments of this application can be implemented is described. The following is in conjunction with... Figure 2 A schematic diagram of Example 200 illustrating a system framework according to some embodiments of this application.
[0064] like Figure 2As shown, example 200 of the system framework includes two parts: a key-value file system 202 on the host side and a key-value solid-state storage 204. On the host side, file 206 is presented to the user. This file 206 is managed by a virtual file system. The user can perform various operations on the file; as shown in example 200, the user performs three write operations 208, 210, and 212 on file 206. For the user's operations, the host-side key-value file system can convert the metadata and data of the file 206 being operated on into metadata keys 214 and data keys 216. For example, when operating on the metadata of file 206 on the host side, metadata data from the virtual file system can be converted into metadata key 214. During the conversion, the generated metadata key includes a metadata identifier indicating that the key is a metadata key, for example, represented by 'm'. The key-value file system also obtains the identifier of the parent directory of the file 206 to be operated on, such as the inode number of the parent directory. Then, the key-value file system puts the inode number of the parent directory into the metadata key, and also puts the filename of the target file into the metadata key 214. The value corresponding to the metadata key is the file metadata obtained from the operation.
[0065] If the operation on the host side involves data in file 206, it can be converted from a key-value file system to a data key 216. For example, an identifier, such as "d," is stored at the beginning of the data key to identify that the key is a data key. The key-value file system further obtains the identifier of the target file, such as the file's inode number, and puts it into the data key. Since the operation on the data also requires determining which data page of the target file the data is on, the key-value file system also obtains the page identifier of the data to be processed and puts it into the data key 216. The data of the file to be operated on is the value corresponding to the data key. For example, when the virtual file system performs a write operation on the target file, the data to be written is the value corresponding to the data key. Therefore, the key-value file system can convert operations on files into key-value file system operations. In addition to converting the data objects to be processed into key-value operations, it is also necessary to convert the operations of the virtual file system into corresponding operations in the key-value file system.
[0066] Then, the key-value file system assembles key-value operations according to a command format that supports the key-value language. If the operation involves the metadata of the target file, a communication command can be generated using the operation to be performed, the parent directory inode, the filename, and other information, and then sent to the key-value solid-state storage 204. If the operation involves data on a page of the target file, a communication command can be generated using the operation to be performed, the identifier of the target file, the data page containing the data to be processed, and other information, and then sent to the key-value solid-state storage 204. If the operation involves data on multiple pages of the target file, a communication command 222 to be transmitted to the solid-state storage can be generated using command formats 218 and 220. Then, the key-value file system transmits the communication command 222 to the key-value solid-state storage.
[0067] This communication command is a communication protocol command that supports key-value semantics, such as NVMe commands. This command can send metadata keys and one or more data keys (i.e., multiple consecutive access ranges or sporadic access ranges) to the solid-state storage (SSD). The key-value SSD, through node identifiers (e.g., inode numbers) embedded in the key-value semantics, can restore the key-value semantics to file semantics. That is, it converts the metadata keys and data keys into file identifiers and data, respectively, and performs file operations in the corresponding inode area 224 and data page area 226. The storage device is a key-value SSD that supports a communication protocol (such as the NVMe protocol) and primarily restores the key-value semantics to file semantics, managing file inodes and file data.
[0068] The above combination Figure 2 A schematic diagram illustrating the system framework of an embodiment of this application is provided below. Figure 3 This document describes schematic diagrams illustrating examples of metadata keys and data keys according to some embodiments of this application. Example 300 illustrates a representation of metadata key 302 and data key 304 in a key-value file system. For metadata key values, metadata key 302 is expressed as "metadata key identifier: parent directory inode number: filename", where the parent directory inode number is the inode number (file unique identifier) of the parent directory where the file / directory to be processed is located, and the filename is the name of the file / directory. The value is the content of the inode, which includes the attributes of the file object and the direct or indirect inode number of the data page. For data key values, data key 304 is expressed as "data key identifier: file inode number: page index", where the file inode number is the inode number of the file itself, and the page index is the data page number of the data page in the file, such as the first 4KB of data corresponding to page 0, and the last 4KB of data corresponding to page 1.
[0069] The above combination Figure 3The diagram illustrates examples of metadata keys and data keys from embodiments of this application. The following is in conjunction with... Figure 4 This illustration depicts an example process for converting file operations into key-value operations according to some embodiments of this application. Example process 400 can be... Figure 1 It is executed at computing device 102 and any suitable computing device.
[0070] In scenarios where key-value solid-state storage provides storage functionality for recovering file semantics, the key-value file system needs to support the conversion of key values for recovering file semantics and provide access to the key-value solid-state storage. In example process 400, the virtual file system layer 418 supports standard file operations 416, such as the file operations of the Portable Operating System Interface of UNIX (POSIX) standard, including creation operation 402, directory creation operation 404, deletion operation 406, read operation 408, write operation 410, directory read operation 412, and rename operation 414. Creation operation 402 is used to open a file, create a new file, etc. Directory creation operation 404 is used to create a new directory (also called a folder) in the file system. The operation will fail if the parent directory does not exist or if write permissions are not available. Deletion operation 406 is a general delete call that can delete a file or directory. Read operation 408 allows a program to read data from an open file descriptor. It reads the data from the file into a buffer. Write operation 410, corresponding to the read operation, writes data from the buffer to the file. It is a basic operation for performing file output. The directory read operation 412 is used to read directory contents, allowing the program to obtain a list of all files and subdirectories within a directory. The rename operation 414 is used to rename a file or directory. It requires the current filename and the new filename, and the operation will change the file's name from one to another.
[0071] Then, these standard file operations 416 reach the operating system's virtual file system layer 418. The virtual file system layer 418 is connected to a key-value file system 420, which, based on the virtual file system development framework, rewrites the file operations abstracted by the virtual file system, transforming them into key-value operations on metadata keys or data keys. For example, the standard file operations above are converted into set operations 422, get operations 424, delete operations 426, and traversal operations 428 supported by the key-value system. Then, these key-value operations are encapsulated into a communication protocol 430 that supports key-value semantics, such as the NVMe protocol. Finally, corresponding commands are sent to the key-value solid-state storage 432.
[0072] Different file operations are transformed into key-value operations in a key-value file system. Creating a file / directory is transformed into setting a new metadata key-value; deleting a file / directory is transformed into deleting a metadata key-value; writing a file is transformed into setting a data key-value; reading a file is transformed into retrieving a data key-value; displaying a directory is transformed into traversing metadata key-value operations; renaming is transformed into deleting the old metadata key-value and setting a new metadata key-value; creating a symbolic link is transformed into setting a new metadata key-value and setting a new data key-value, where the new data key-value contains the path to the symbolically linked file; and creating a hard link is transformed into setting a new metadata key-value, where the inode of this new metadata key-value points to the inode content of the hard-linked file.
[0073] After the key-value file system completes the conversion of key-value operation commands, it needs to send the key-value operations to the storage device side using a communication protocol that supports key-value semantics. The following section combines... Figure 5 A schematic diagram illustrating examples of commands representing multiple access spaces according to some embodiments of this application.
[0074] As shown in Example 500, when processing logically contiguous data pages, command format 502 indicates that operations on multiple logically contiguous data pages of a target file can be transmitted in a single command. This command format includes an opcode, which indicates the type of key-value operation, such as a set operation, a delete operation, etc. Command format 502 may further include an inode number, which is the inode number of the target file to be processed, indicating the target file to be processed. Following the inode number may be N consecutive ranges, where N is a positive integer, to indicate that the command can transmit operations on multiple consecutive ranges. For example, N = 6, indicating that the command can transmit 6 consecutive ranges. Each consecutive range includes the page index of the starting page of the consecutive range and the number of data pages included in the consecutive range. If the page index of the starting page is 3 and the number of pages included in the consecutive range is 5, then the consecutive range is represented as 3 + 5. Therefore, one command can perform operations on N consecutive ranges.
[0075] When processing logically discrete data pages, command format 504 represents an example of transmitting processing of logically discrete data pages of a target file in a single command. This command format includes an opcode indicating the type of key-value operation, such as a set operation, a delete operation, etc. Command format 504 may further include an inode number, which is the inode number of the target file to be processed, indicating the target file to be processed. Following the inode number are a start page index and a bitmap to indicate that the command can transmit operations on multiple discrete data pages. The start page index can be the index of the first page of the target file, or it can be the index of a data page in the target file. The bitmap then corresponds to multiple pages following the page corresponding to the start page index, with each page following the start page having a corresponding bit indicating whether the page needs to be processed. If a subsequent page needs to be processed, the corresponding bit in the bitmap can be set to 1; otherwise, it is set to 0. Therefore, this command can process multiple logically discrete data pages.
[0076] In some embodiments, the NVMe communication protocol can be used as an example for implementation and modification, and the communication protocol (such as the NVMe / UNIX file system (UFS)) and software driver can be extended to achieve this. Figure 5 The command format shown is adapted to support key-value transfers for restoring file semantics. Firstly, for example, NVMe command fields can be extended based on the NVMe protocol basic specification and the NVMe key-value protocol specification to support metadata and data key-value pairs. Specifically, the NVMe key-value protocol specification clearly defines the position of information such as the key and key length in the command for different operations, while the value is represented using the dptr field from the general original command. For example... Figure 5 As shown, in order to represent multiple consecutive or sporadic access ranges, the reserved fields in the NVMe key-value commands (CDW2, CDW3, CDW10-CDW15. The reserved fields reused by different key-value operations are not exactly the same, depending on the remaining reserved fields in the NVMe key-value protocol) can be used to represent a bitmap (page index + bitmap) of 6 consecutive access ranges (page index + bitmap).
[0077] Figure 6The diagram illustrates examples of drivers supporting key-value semantics according to some embodiments of this application. In example 600, the original NVMe driver 620 does not support key-value recovery of file semantics; it only enables data interaction with devices (such as graphics cards) 622 that rely on the original NVMe driver. To obtain an NVMe driver supporting key-value semantics, an NVMe driver 616 supporting key-value semantics is obtained by extending the original NVMe driver (which does not support key-value recovery of file semantics). This allows the file semantics to be recovered to be integrated into communication commands supporting key-value semantics and sent to the key-value solid-state storage 618. Figure 6 As shown, the NVMe driver 616 supporting key-value semantics can run simultaneously with the original NVMe driver 620 without interfering with devices that rely on the original NVMe driver. Simultaneously, the NVMe driver supporting key-value semantics also publishes a communication protocol interface 614 supporting key-value semantics, enabling the key-value file system 604 to use the corresponding interface. This allows it to encapsulate key-value operations, such as set operation 606, get operation 608, delete operation 610, and traversal operation 612, into NVMe commands and send them to the key-value solid-state storage 618. These key-value operations are obtained by the key-value file system 604 converting file operation 602.
[0078] Figure 7 A schematic diagram 700 comparing key-value file system I / O and traditional file system I / O according to some embodiments of this application is shown. A key-value file system integrating an NVMe driver supporting key-value semantics simplifies the I / O stack and reduces file system latency on the host or computing device side compared to a traditional file system. For file operation 702, in a traditional file system such as F2FS 704, the I / O request needs to be sent to a software I / O queue 708, such as a First-In-First-Out (FIFO) queue. Then, the I / O scheduler 710 sends it to the NVMe driver's commit queue 712. However, for the key-value file system 706, it can directly send key-value operation requests to the NVMe driver's commit queue 712 through the NVMe driver interface supporting key-value semantics, without going through the software I / O queue and I / O scheduler.
[0079] Key-value semantics can significantly reduce the number of I / O operations on the host side for different file operations, thereby alleviating the load on the central processing unit (CPU) of the host or computing device. For example... Figure 8As shown in Example 800, key-value semantics simplifies the representation of file system metadata, requiring only a single I / O operation to complete the corresponding operation. In contrast, traditional file systems (such as F2FS) require multiple I / O operations to process file system metadata (e.g., data bitmaps, inode bitmaps, inode data, etc.). For example, when creating a file, a traditional file system requires 6 I / O operations, while a key-value file system (KVFS) only needs one.
[0080] Furthermore, the storage device manages the key-value pairs after receiving them. For example, a key-value solid-state storage (SSD) receives and manages key-value pairs. Upon receiving a key-value pair, the SSD first locates the inode of the corresponding file using the inode number within the key. After finding the inode, it reconstructs the file semantics using the value's content. Then, it performs relevant file operations (such as reading / writing / deleting / traversing) based on specific operation types (e.g., read / write / delete files, traverse directories, etc.). In key-value SSDs, a trie can be used for fast indexing of inode numbers, ensuring efficient lookup. In some embodiments, after reconstructing the file semantics, the SSD is partitioned, storing file metadata, data, and file system metadata in different partitions for more rational and efficient management. For example, data pages of the same file can be written to the same block, which facilitates garbage collection within the SSD; precise hot / cold data separation can also be performed for different file types, which helps with wear leveling within the SSD.
[0081] Figure 9 A schematic flowchart of a method for performing file operations according to some embodiments of this application is shown. Example method 900 can be... Figure 1 It can be executed on computing device 102 or any suitable computing device.
[0082] At box 902, the computing device receives an operation request for a target file, which includes a file identifier associated with the target file. When operating on the target file via computing device 102, the operation request is generated in the virtual file system layer of the computing device's operating system. This operation request includes the identifier of the file to be processed, the type of operation to be performed, and the data information to be processed. For example, the data information may be metadata for the target file or data for the target file. Additionally, when processing the metadata of the target file, the request may further include the identifier of the target file's parent directory. The operation request is then passed to the key-value file system 108, which implements the specific functions of the virtual file system. In the key-value file system, the identifier of the target file or the identifier of the target file's parent directory can be obtained from the operation request. Alternatively or additionally, the file identifier is an inode number.
[0083] In some embodiments, if the operation request is for the metadata of the target file, the computing device needs to obtain the identifier of the parent directory of the target file and then determine the identifier of the parent directory of the target file as the file identifier. In some embodiments, if the operation request is for the data of the target file, the computing device can obtain the identifier of the target file and then determine the identifier of the target file as the file identifier.
[0084] At box 904, the computing device provides a communication command for key-value operations in the key-value file system to the storage device to perform operations on a target file using the file identifier, where the key in the key-value operation includes the file identifier. After the computing device obtains the file identifier in its key-value file system, it combines it with other information in the operation request to generate a key that can be used in the key-value file system.
[0085] In some embodiments, when generating a key that includes a file identifier for use in a key-value file system, if the operation request is for the metadata of the target file, such as creating or deleting a file, the identifier of the target file's parent directory can be set as the file identifier in the key. Furthermore, the computing device also needs to obtain the filename of the target file and then use the file identifier of the parent directory and the filename of the target file to generate a metadata key for the metadata. Therefore, the metadata key includes the identifier of the parent directory and the filename of the target file.
[0086] Furthermore, when generating keys that include file identifiers for use in the key-value file system, if the operation request is not for the metadata of the target file, it can be determined that the operation request is for the data of the target file. In this case, the computing device determines the identifier of the target file as the file identifier. Additionally, when generating keys for the data, the computing device also needs to obtain the identifier of the data page containing the data to be operated on, which can be obtained from the virtual file system. Then, the computing device uses the file identifier of the target file and the identifier of the data page to generate data keys for the data.
[0087] In some embodiments, after generating the keys for the key-value storage system, the original file operations need to be converted into key-value operations. Since the keys include semantic information about the file, the file semantics can be implemented on the storage device after the key-value operations are passed to the storage device to manage data using the file format.
[0088] In some embodiments, when providing a key to a storage device, the computing device can use the obtained key to convert file operations into key-value operations for a key-value file system, where the key-value operations include a file identifier and the type of operation. The computing device then encapsulates the key-value operations into a communication command that supports key-value semantics, such as an NVMe command that supports key-value semantics. This communication command is then passed to the storage device so that the storage device can use the file identifier to perform operations on the target file.
[0089] In some embodiments, when encapsulating key-value operations into communication commands that support key-value language, the computing device may further determine whether the key-value operation is for a single data page of the target file or for multiple data pages of the target file. If the key-value operation is for a single data page of the target file, the key-value operation for that single data page can be directly encapsulated into a communication command and passed to the storage device. For example, the command may include the type of operation and the data key for that single data page. If it is determined that the key-value operation is for multiple data pages of the target file, the computing device generates communication commands for multiple data pages, such that the key-value operations for all multiple data pages are transmitted simultaneously in a single communication command.
[0090] In some embodiments, if it has been determined that the key-value operation targets multiple data pages of the target file, the computing device further needs to determine whether the multiple data pages are consecutive when generating the communication command for the multiple data pages. This is because different command formats are set for consecutive multiple data pages or discrete multiple data pages in the communication command format for transmitting the key-value operation. If the multiple data pages are consecutive, the computing device also needs to determine the identifier of the starting page of the multiple data pages and the number of multiple data pages. Then, the identifier of the starting page and the number of multiple data pages are added to the communication command for the consecutive data pages to indicate that file operation is performed on the number of data pages starting from that starting page. Additionally, when performing the same operation on other consecutive pages of the target file, other consecutive pages of the target file can be added to the communication command. For example, if the first set of added multiple data pages is a first set of multiple data pages, and the key-value operation also targets a second set of consecutive multiple data pages of the target file, the computing device can further determine the identifier of the starting page of the second set of multiple data pages and the number of the second set of multiple data pages. The computing device then adds the identifier of the starting page of the second set of data pages, along with the number of the second set of data pages, to the communication command. This addition operation can be performed multiple times, thus allowing operations on multiple consecutive sets of pages to be transmitted in a single communication command.
[0091] In some embodiments, if the multiple data pages are discrete data pages, the computing device can determine an identifier for the starting page of the target file. In one example, the identifier for the starting page is the identifier of the first data page of the target file. In another example, the identifier for the starting page can be the identifier of any suitable data page in the target file, such as the data page with the smallest data page identifier among the multiple discrete data pages. The computing device then generates a bitmap for the multiple data pages based on the starting page and the multiple discrete data pages. The computing device then uses the identifier for the starting page of the target file and the bitmap to generate communication commands. For example, the communication command has 8 bytes for the bitmap, with each byte having 8 bits. Each bit can be used as a single bit in the bitmap to correspond to a data page to indicate whether it needs to be processed. Therefore, the 8-byte bitmap can be used to indicate 64 data pages.
[0092] The computing device transmits key-value operations to the storage device via communication commands. In some embodiments, the communication commands transmitting key-value operations to the storage device are commands that support the Non-Volatile Memory Fast Pass Protocol (NVRAM). If the storage device is internal to the computing device, after receiving the communication commands, the storage device can further utilize the communication commands to determine the file identifier included in the communication commands and the type of operation to be performed on the target file. The computing device can then further obtain the value corresponding to the key in the key-value operation. The computing device then uses the file identifier, value, and type to perform the operation on the target file.
[0093] This method places the file identifier of the virtual file system in the key of the key-value file system and passes the file identifier to the storage device through the key. In this way, the file semantics are passed through the key-value transfer, so that the storage device can store and manage data in the manner of a file system. This reduces the use of storage resources, computing resources and transmission resources, improves processing efficiency and enhances user experience.
[0094] Figure 9 A schematic flowchart illustrating the methods for performing file operations on the host side is provided below. Figure 10 A schematic flowchart illustrating another method for performing file operations according to some embodiments of this application is provided. Figure 10 Method 1000 can be executed on the storage device side, for example, it can be executed on the storage device side. Figure 1 It can be executed on storage device 104 or any suitable storage device.
[0095] At box 1002, the storage device receives communication commands for key-value operations in a key-value file system, where the key in the key-value operation includes a file identifier associated with the target file being operated on. Storage device 104 is used to store data from the file system, and the storage device can receive communication commands supporting key-value semantics from the key-value file system and parse the commands to translate the key-value semantics into operations for file semantics.
[0096] At box 1004, the storage device performs operations on a target file based on a file identifier. Upon receiving a communication command, the storage device parses it to determine the file identifier in the key-value operation and the type of operation to be performed. The file identifier is associated with the target file in the virtual file system. For example, the storage device can obtain the key transmitted by the communication command, thereby obtaining the file identifier associated with the target file stored in the key, and can also obtain the type of operation to be performed from the communication command. For example, the type of operation to be performed can be determined from the opcode of the communication command. Furthermore, it can be combined with other information communication commands to convert them into operation commands for the file system.
[0097] In some embodiments, if the storage device parses the identifier of a data page and the number of data pages in a communication command, the storage device can determine that the operation is for multiple consecutive data pages starting with that data page. If the storage device parses the identifier of a data page and a bitmap of the data page in a communication command, it can determine that the operation is for multiple discrete data pages.
[0098] In some embodiments, the storage device can also retrieve the value corresponding to the key in a key-value operation. After retrieving the key for a key-value operation using a communication command, the storage device can further retrieve the value corresponding to the key using other information included in the communication command, such as the storage location of the data in the cache of the computing device, through another operation. The storage device can then use this storage location to retrieve the value corresponding to the key, such as the data from the operation execution. Any suitable method can be used to retrieve this value.
[0099] In some embodiments, the storage device performs operations on a target file based on the file identifier, value, and type. Having obtained the file identifier, value, and type, the storage device can recover the file semantics to perform operations on the target file within the inode area and data page area of the storage device.
[0100] In some embodiments, the computing device may use a file identifier and a value to determine the data object to which the operation is targeted. If the storage device recognizes a file identifier and filename from the communication command, and the value corresponds to metadata, it can be determined that the file identifier is the parent directory identifier of the target file. Therefore, it can be determined that the operation is targeting the metadata of the target file. In some embodiments, if the storage device recognizes information such as a file identifier and page identifier from the communication command, and the value corresponds to data, it can be determined that the operation is targeting the data of the target file. The storage device then performs the operation on the data object. Alternatively or additionally, the metadata and data of the target file are stored in different partitions.
[0101] This method obtains file identifiers and operation types by receiving communication commands that support key-value semantics. File semantic information can then be obtained from these commands, enabling storage devices to store and manage data in a file system manner after obtaining the file identifier. This reduces the use of storage, computing, and transmission resources and improves the user experience.
[0102] Figure 11 A block diagram of an apparatus 1100 for performing file operations according to an embodiment of this application is further shown. The apparatus 1100 is applied to a computing device and may include multiple modules for performing operations such as... Figure 9 The corresponding steps in method 900 discussed herein. For example... Figure 11 As shown, the apparatus 1100 includes: an operation request acquisition unit 1102, configured to receive a communication command for a key-value operation in a key-value file system, wherein the key in the key-value operation includes a file identifier associated with the target file being operated on; and a communication command providing unit 1104, configured to provide the communication command for the key-value operation in the key-value file system to a storage device to perform an operation on the target file using the file identifier, wherein the key in the key-value operation includes the file identifier.
[0103] In some embodiments, if the operation request is for the metadata of the target file, the file identifier is the identifier of the parent directory of the target file; and if the operation request is for the data of the target file, the file identifier is the identifier of the target file.
[0104] In some embodiments, the key is a metadata key for the target file, and the key includes the identifier of the parent directory and the filename of the target file.
[0105] In some embodiments, the key is a data key for the target file, and the key includes an identifier of the target file and an identifier of the data page where the data to be operated is located.
[0106] In some embodiments, the communication command providing unit 1104 includes: an operation conversion unit configured to convert operations on a target file into key-value operations for a key-value file system, the key-value operations including a file identifier and an operation type; an encapsulation unit configured to encapsulate the key-value operations into a communication command supporting key-value semantics; and a first providing unit configured to provide the communication command to a storage device to perform operations on the target file using the file identifier.
[0107] In some embodiments, the communication commands support key-value operations on multiple data pages of the target file.
[0108] In some embodiments, the multiple data pages are contiguous, and the communication command includes an identifier of the starting page of the multiple data pages and the number of the multiple data pages.
[0109] Figure 12 A block diagram of an apparatus 1200 for performing file operations according to an embodiment of this application is further shown. The apparatus 1200 is applied to a storage device and may include multiple modules for performing operations such as... Figure 10 The corresponding steps in process 1000 discussed herein. For example... Figure 12 As shown, the device 1200 includes: a communication command receiving unit 1202, configured to receive communication commands for key-value operations in a key-value file system, wherein the key in the key-value operation includes a file identifier associated with the target file being operated on; and an operation execution unit 1204, configured to perform operations on the target file based on the file identifier.
[0110] In some embodiments, the operation execution unit 1204 includes: a value acquisition unit configured to acquire a value corresponding to a key in a key-value operation; and a first execution unit configured to perform an operation on a target file based on a file identifier and a value.
[0111] In some embodiments, if the file identifier is the identifier of the parent directory of the target file and the value is the metadata of the target file, then the operation is performed on the metadata of the target file; and if the file identifier is the identifier of the target file and the value is the data of the target file, then the operation is performed on the data of the target file.
[0112] In some embodiments, the metadata and data of the target file are stored in different partitions.
[0113] In some embodiments, the communication command includes an identifier of a data page and the number of data pages, and the operation is directed at multiple consecutive data pages starting from a data page.
[0114] Figure 13A schematic block diagram of an example device 1300 that can be used to implement embodiments of the present application is shown. For example, according to embodiments of the present application. Figure 1 Both the computing device 102 and the storage device 104 can be implemented by the example device 1300. As shown, device 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) 1302 or loaded from storage unit 1308 into random access memory (RAM) 1303. Various programs and data required for the operation of device 1300 can also be stored in RAM 1303. The CPU 1301, ROM 1302, and RAM 1303 are interconnected via bus 1304. Input / output (I / O) interface 1305 is also connected to bus 1304.
[0115] Multiple components in device 1300 are connected to I / O interface 1305, including: input unit 1306, such as keyboard, mouse, etc.; output unit 1307, such as various types of monitors, speakers, etc.; storage unit 1308, such as disk, optical disk, etc.; and communication unit 1309, such as network card, modem, wireless transceiver, etc. Communication unit 1309 allows device 1300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0116] The various processes and procedures described above, such as methods 900 and 1000, can be executed by processing unit 1301. For example, in some embodiments, methods 900 and 1000 can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 1308. In some embodiments, part or all of the computer program can be loaded and / or installed on device 1300 via ROM 1302 and / or communication unit 1309. When the computer program is loaded into RAM 1303 and executed by CPU 1301, one or more actions of methods 900 and 1000 described above can be performed.
[0117] This application may be a method, apparatus, system, chip, and / or computer program product. A chip may include a processing unit and a communication interface, the processing unit being capable of processing program instructions received from the communication interface. A computer program product may include a computer-readable storage medium on which computer-readable program instructions for performing various aspects of this application are stored.
[0118] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0119] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0120] The computer program instructions used to perform the operations of this application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuits, such as programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing state information from the computer-readable program instructions. These electronic circuits can execute the computer-readable program instructions to implement various aspects of this application.
[0121] Various aspects of this application are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0122] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0123] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0124] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0125] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for performing file operations, characterized in that, include: Obtain an operation request for a target file, the operation request including a file identifier associated with the target file; as well as Communication commands for key-value operations in a key-value file system are provided to the storage device to perform operations on the target file using the file identifier, wherein the key in the key-value operation includes the file identifier.
2. The method according to claim 1, characterized in that, If the operation request is directed to the metadata of the target file, the file identifier is the identifier of the parent directory of the target file; and If the operation request is for data of the target file, the file identifier is the identifier of the target file.
3. The method according to claim 2, characterized in that, The key is a metadata key for the target file, and the key includes the identifier of the parent directory and the filename of the target file.
4. The method according to claim 2, characterized in that, The key is a data key for the target file, and the key includes the identifier of the target file and the identifier of the data page where the data to be operated is located.
5. The method according to claim 1, characterized in that, The provision of communication commands for key-value operations in the key-value file system to the storage device to perform operations on the target file using the file identifier includes: Based on the key, operations targeting the target file are converted into key-value operations for the key-value file system, wherein the key-value operations include the file identifier and the type of operation; Encapsulate the key-value operations into the communication commands that support key-value semantics; and The communication command is provided to the storage device to perform an operation on the target file using the file identifier.
6. The method according to claim 5, characterized in that, The communication commands support key-value operations on multiple data pages of the target file.
7. The method according to claim 6, characterized in that, The plurality of data pages are consecutive, and the communication command includes an identifier of the starting page of the plurality of data pages and the number of the plurality of data pages.
8. A method for performing file operations, characterized in that, include: Receive communication commands for key-value operations in a key-value file system, wherein the key in the key-value operation includes a file identifier associated with the target file being operated on; as well as Based on the file identifier, perform operations on the target file.
9. The method of claim 8, wherein performing the operation on the target file based on the file identifier comprises: Retrieve the value corresponding to the key in the key-value operation; as well as Based on the file identifier and the value, perform the operation on the target file.
10. The method according to claim 9, characterized in that, If the file identifier is the identifier of the parent directory of the target file and the value is the metadata of the target file, then the operation is performed on the metadata of the target file; as well as If the file identifier is the identifier of the target file and the value is the data of the target file, then the operation is performed on the data of the target file.
11. The method according to claim 10, characterized in that, The metadata and data of the target file are stored in different partitions.
12. The method according to claim 11, characterized in that, The communication command includes the identifier of the data page and the number of data pages, and the operation is applied to multiple consecutive data pages starting from the data page.
13. An apparatus for performing file operations, characterized in that, include: The operation request acquisition unit is configured to receive communication commands for key-value operations in a key-value file system, wherein the key in the key-value operation includes a file identifier associated with the target file being operated on; as well as A communication command providing unit is configured to provide a storage device with a communication command for a key-value operation in a key-value file system to perform an operation on the target file using the file identifier, wherein the key in the key-value operation includes the file identifier.
14. An apparatus for performing file operations, characterized in that, include: The communication command receiving unit is configured to receive communication commands for key-value operations in a key-value file system, wherein the key in the key-value operation includes a file identifier associated with the target file being operated on; as well as The operation execution unit is configured to perform operations on the target file based on the file identifier.
15. An electronic device comprising: At least one computing unit; At least one memory coupled to the at least one computing unit and storing instructions for execution by the at least one computing unit, the instructions, when executed by the at least one computing unit, causing the device to perform the method according to any one of claims 1-7 or 8-12.
16. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method according to any one of claims 1-7 or 8-12.
17. A computer program product comprising computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the method according to any one of claims 1-7 or 8-12.