Method and apparatus for file freezing based on direct access device
Patent Information
- Application Number
- CN202210142686.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-16
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-02-16
AI Technical Summary
[0004]本发明提供一种基于直接访问设备的文件冻结方法及装置,用以解决现有技术中无法对文件进行冻结缺陷,可以保证文件在传输前后的一致性
[0013]第五方面,本发明实施例还提供了一种计算机程序产品,其上存储有可执行指令,该指令被处理器执行时使处理器实现如第一方面所述的基于直接访问设备的文件冻结方法的步骤。
Smart Images

Figure CN116643836B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of file transfer, and more particularly to a method and apparatus for freezing files based on direct access devices. Background Technology
[0002] Firstly, Virtiofs DAX is a relatively new technology application that has been around for the past two years. It provides a high-performance DAX pass-through technology in virtualization scenarios, which allows virtual machines to directly map files in a second memory, avoiding multiple content copies.
[0003] However, Virtiofs DAX technology has some limitations in file transfer. For example, in the current Virtiofs DAX environment, a "freeze" technology is not provided. This is because Virtiofs is different from traditional file systems; it is essentially a PCI hardware device. Therefore, it cannot provide a freeze interface in the "superblock" like traditional file systems. This may cause files to change during transmission, and the consistency of files before and after transmission cannot be guaranteed. Summary of the Invention
[0004] This invention provides a file freezing method and apparatus based on direct access devices, which solves the defect of existing technologies that cannot freeze files and can ensure the consistency of files before and after transmission.
[0005] In a first aspect, embodiments of the present invention provide a file freezing method based on a direct access device, applied to a virtual machine in a semi-virtualized scenario, comprising: sending an access request to a backend direct access device in a second operating system running on a computer via a frontend direct access device in a first operating system running on the virtual machine, receiving a response from the backend direct access device, and obtaining any one pass-through file in the second operating system; obtaining all pass-through files in the first operating system based on the arbitrary pass-through file via the frontend direct access device; determining, via the frontend direct access device, pass-through files that have not been written to disk among all pass-through files, and sending a write request to the backend direct access device to write the pass-through files that have not been written to disk to the disk; responding to the write request via the backend direct access device, writing the pass-through files that have not been written to disk to the disk, and notifying the frontend access device; setting a stop-write flag on the frontend direct access device; and suspending the write of the pass-through files to the disk.
[0006] Furthermore, the step of obtaining all transparent files in the second operating system based on any one transparent file through the front-end direct access device includes: obtaining the superblock corresponding to the file system in the first operating system based on any one transparent file through the front-end direct access device; and obtaining all transparent files based on the linked list of the superblock.
[0007] Furthermore, sending a write request to the backend direct access device to write the pass-through file that has not been written to the disk to the disk includes: sending a write request to the backend direct access device to write the file data of the pass-through file that has not been written to the disk to the disk; and sending a request to the backend direct access device to write the metadata of the pass-through file that has not been written to the disk to the disk.
[0008] Furthermore, before determining the pass-through files that have not been written to disk in all pass-through files through the front-end direct access device, the method further includes: converting the file format of all pass-through files into a file format compatible with the file system of the second operating system by mounting the Fuse server on the second operating system.
[0009] Further, the step of converting the file format of all the pass-through files to a file format compatible with the file operating system of the second operating system via the Fuse server mounted on the second operating system includes: transferring all the pass-through files to the Fuse server via a Fuse client mounted on the first operating system based on a preset protocol; and converting the file format of all the pass-through files to a file format compatible with the file operating system of the second operating system via the Fuse server. Further, before issuing an access request from the front-end direct access device in the first operating system running on the virtual machine to the back-end direct access device in the second operating system, the step further includes: obtaining the front-end direct access device in the first operating system based on a preset framework.
[0010] Secondly, the present invention also provides a file freezing device based on a direct access device, applied to a virtual machine in a semi-virtualized scenario, comprising: a first acquisition module, configured to send an access request to a backend direct access device in a second operating system through a frontend direct access device in a first operating system running on the virtual machine, receive a response from the backend access device, and acquire any one pass-through file in the second operating system; a second acquisition module, configured to acquire all pass-through files in the first operating system based on the arbitrary pass-through file through the frontend direct access device; a sending module, configured to determine, through the frontend direct access device, pass-through files that have not been written to disk among all pass-through files, and send a write request to the backend direct access device to write the pass-through files that have not been written to disk to the disk; a writing module, configured to respond to the write request through the backend direct access device, write the pass-through files that have not been written to disk to the disk, and notify the frontend access device; a setting module, configured to set a stop-writing flag for the frontend direct access device; and a suspending module, configured to suspend the write of pass-through files to the disk.
[0011] Thirdly, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the file freezing method based on direct access device as described in the first aspect.
[0012] Fourthly, embodiments of the present invention also provide a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the file freezing method based on a direct access device as described in the first aspect.
[0013] Fifthly, embodiments of the present invention also provide a computer program product having executable instructions stored thereon, which, when executed by a processor, cause the processor to implement the steps of the file freezing method based on direct access device as described in the first aspect.
[0014] This invention provides a file freezing method and apparatus based on direct access devices, applied to virtual machines in a semi-virtualized scenario. It involves a front-end direct access device running on a first operating system within the virtual machine sending an access request to a back-end direct access device running on a second operating system on the computer, receiving a response from the back-end direct access device, and obtaining any one pass-through file in the second operating system. The front-end direct access device then retrieves all pass-through files in the first operating system based on this one file. It identifies pass-through files that have not yet been written to disk and sends a write request to the back-end direct access device to write these files to disk. The back-end direct access device responds to the write request, writes the unwritten pass-through files to disk, and notifies the front-end access device. A stop-write flag is set on the front-end direct access device. The process of writing pass-through files to disk is suspended. By writing the unwritten pass-through files to disk, all pass-through files are saved. Then, writing operations on the pass-through files are stopped, and all pass-through files are suspended, preventing any reading or modification operations. This freezes the pass-through files, ensuring their consistency before and after transmission. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0016] Figure 1 This is a flowchart illustrating an embodiment of a file freezing method based on direct access to a device provided by the present invention.
[0017] Figure 2 This is a flowchart illustrating an embodiment of a method for obtaining all transparent files provided by the present invention;
[0018] Figure 3 This is a flowchart illustrating an embodiment of a method for synchronously transmitting files provided by the present invention;
[0019] Figure 4 This is a schematic diagram illustrating the structural composition of an embodiment of a file freezing device based on direct access to a device provided by the present invention.
[0020] Figure 5 A schematic diagram of the physical structure of an electronic device is provided. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0022] Figure 1 This is a flowchart illustrating an embodiment of a file freezing method based on direct access to a device provided by the present invention. Figure 1 As shown, the file freezing method based on direct device access, applied to virtual machines in a semi-virtualized scenario, may include the following steps:
[0023] S101, the front-end direct access device in the operating system running on the virtual machine sends an access request to the back-end direct access device in the second operating system, receives the response from the back-end direct access device, and obtains any pass-through file in the second operating system.
[0024] In step 101, a virtual machine (VM) refers to a special type of software that creates an environment between a computer platform and the end user, allowing the end user to operate the software within that environment. In computer science, a virtual machine is a software implementation of a computer that can run programs like a real machine.
[0025] Paravirtualization requires modifications to the system kernel to achieve virtualization. It necessitates modifications to the operating system running on the virtual machine, which then recognizes that it is running in a virtual environment and provides similar performance. In a paravirtualization scenario, the virtual machine is described by the virtio structure.
[0026] Direct access, or DAX for short, allows direct access to memory space. When a front-end DAX device initiates an access request to a back-end DAX device, the back-end DAX device responds to the request. The front-end DAX device is then allowed to bypass the first operating system's cache and directly map the second operating system's page cache into the first operating system's address space. File data does not need to be copied within the first operating system; it can be directly accessed from the second operating system's page cache, allowing any pass-through file to be retrieved from the second operating system.
[0027] S102, by directly accessing the device through the front end, all transparent files are obtained in the first operating system based on any one transparent file.
[0028] In step S102, the front-end direct access device can obtain all transparent files in the first operating system based on any one of the obtained transparent files. Since the virtual machine is mounted on the second operating system, the front-end direct access device can directly access the second operating system; therefore, all transparent files obtained in the first operating system are equivalent to all transparent files in the second operating system.
[0029] S103: The front-end direct access device identifies the pass-through files that have not been written to disk among all pass-through files, and sends a request to the back-end direct access device to write the pass-through files that have not been written to disk to disk.
[0030] In step S103, the pass-through files that have not been written to the disk are the pass-through files that have not been saved. Therefore, the front-end direct access device needs to confirm whether all pass-through files have been written to the disk, locate the pass-through files that have not been written to the disk, and send a request to the back-end direct access device to write the pass-through files that have not been written to the disk to the disk.
[0031] S104, responding to the write request by directly accessing the device from the backend, writes the pass-through file that has not yet been written to the disk to the disk, and notifies the frontend to access the device.
[0032] In step S104, the backend direct access device responds to the write request from the frontend direct access device by writing the pass-through files that have not yet been written to disk to the disk. At this point, all pass-through files have been written to disk, meaning all pass-through files have been saved, and the frontend direct access device is notified of this message.
[0033] S105 sets a flag to stop writing to the front-end directly accessed device.
[0034] In step S105, after the front-end access device learns that all transparent files have been written to the disk, the virtual machine can also obtain this information and set a stop-write flag for the front-end direct access device. The stop-write flag can be FUSE NOWRITE, and this embodiment of the invention does not limit the stop-write flag. By setting the stop-write flag for the front-end direct access device, the front-end direct access device can be prevented from writing to the transparent files.
[0035] S106, suspend the pass-through file to be written to disk.
[0036] In step S106, based on the operation in step S104, it is known that all pass-through files have been written to disk. Suspending the pass-through files written to disk means suspending all pass-through files. The queue of all pass-through files can be suspended using the command `virtio_fs_stop_all_queues`. By suspending all pass-through files, reading from all pass-through files can be stopped.
[0037] The file freezing method based on direct access devices provided in this invention is applied to virtual machines in a semi-virtualized scenario. It includes: sending an access request from a front-end direct access device in a first operating system running on the virtual machine to a back-end direct access device in a second operating system running on the computer; receiving a response from the back-end direct access device; obtaining any one pass-through file in the second operating system; obtaining all pass-through files in the first operating system based on the arbitrary pass-through file using the front-end direct access device; identifying pass-through files not yet written to disk among all pass-through files using the front-end direct access device; sending a write request to the back-end direct access device to write the unwritten pass-through files to disk; the back-end direct access device responding to the write request by writing the unwritten pass-through files to disk and notifying the front-end access device; setting a stop-write flag on the front-end direct access device; and suspending the pass-through files to disk. By writing the unwritten pass-through files to disk, ensuring that all pass-through files are saved, then stopping the write operation on the pass-through files and suspending all pass-through files, any read or modification operation on the pass-through files is stopped, thus freezing the pass-through files and ensuring their consistency before and after transmission.
[0038] Figure 2 This is a flowchart illustrating an embodiment of a method for obtaining all transparent files provided by the present invention. Figure 2 As shown, the method for obtaining all transparent files may include the following steps:
[0039] S201, by directly accessing the device through the front end, obtains the superblock corresponding to the file system in the first operating system based on any transparent file.
[0040] In step S201, the file system is the method and data structure used by the operating system to define files on storage devices (commonly disks, but also solid-state drives based on NAND Flash) or partitions; that is, the method of organizing files on storage devices. The software mechanism in the operating system responsible for managing and storing file information is called the file management system, or file system for short. It is responsible for creating files for users, storing, reading, modifying, and dumping files, controlling file access, and deleting files when the user no longer needs them.
[0041] The superblock is the first block in a file system. This block stores the structure information of the file system itself. For example, the superblock records the size of each region, and it also stores information about unused disk blocks. There is a one-to-one correspondence between the file system and the superblock.
[0042] S202, retrieve all transparent files based on the linked list of the superblock.
[0043] In step S202, a specific field in the superblock, such as s_inodes, represents a linked list that describes all pass-through files on this file system.
[0044] The method for obtaining all transparent files provided by this invention locates the superblock of the file system through any transparent file, and can quickly and accurately obtain all transparent files based on the linked list on the superblock.
[0045] Figure 3 This is a flowchart illustrating an embodiment of a method for synchronously transmitting files provided by the present invention. Figure 3 As shown, the method for synchronously transmitting files may include the following steps:
[0046] S301 sends a request to the backend direct access device to write the file data of the pass-through file that has not yet been written to the disk to the disk.
[0047] S302 sends a write request to the backend direct access device to write the metadata of the pass-through file that has not yet been written to the disk to the disk.
[0048] In steps S301 and S302, the write request sent to the backend direct access device may include writing the file data and metadata of the pass-through file that has not yet been written to disk to the disk. The file data refers to the data that makes up the file itself, while the metadata, also known as intermediary data or relay data, is data describing the file data (data about data), mainly describing the file data properties to support functions such as indicating storage location, historical data, resource lookup, and file records. The metadata of the pass-through file is stored in the superblock.
[0049] The method for synchronizing transparent files provided by this invention can save the transparent file on the disk by writing the file data and metadata of the transparent file that has not been written to the disk, thereby achieving synchronization of the transparent file.
[0050] In some optional embodiments, before determining the pass-through files that have not been written to disk in all pass-through files by directly accessing the device from the front end, the method may further include: converting the file format of all pass-through files into a file format compatible with the file system of the second operating system by mounting a Fuse server on the second operating system.
[0051] Before the format conversion, all the files passed through exist in a common format in the second operating system, and they need to be converted into a format compatible with the corresponding file system for further processing.
[0052] In this embodiment of the invention, all pass-through files exist in a common format in the second operating system before format conversion. Converting them according to the format adapted to the corresponding file system can realize the transfer of pass-through files between multiple file systems.
[0053] In some optional embodiments, converting the file format of all transparently transmitted files to a file format compatible with the file operating system of the second operating system by mounting a Fuse server on the second operating system may include: transferring all transparently transmitted files to the Fuse server by a Fuse client mounted on the first operating system based on a preset protocol; and converting the file format of all transparently transmitted files to a file format compatible with the file operating system of the second operating system by the Fuse server. The preset protocol may be the FUSE protocol.
[0054] In some optional embodiments, before sending an access request from a front-end direct access device in a first operating system running on a virtual machine to a back-end direct access device in a second operating system, the method may further include: obtaining the front-end direct access device in the first operating system based on a preset framework.
[0055] The default framework can be the virtio framework. In a paravirtualization scenario, virtual machines are described by virtio structures. Therefore, in the current context, the first operating system (virtiofs) is also described by virtio_device. The virtio_fs structure is obtained through virtio_device->priv. Each virtual device requires a virtual driver to complete its specific configuration and functions. The priv field in virtio_device points to the associated virtual driver. In this context, priv points to the virtio_fs structure in virtiofs. This structure describes the fields related to the virtual file system implemented in paravirtualization. The dax_device is obtained through the virtio_fs structure. The dax_device field in the virtio_fs structure describes the device directly accessed by the front end.
[0056] Figure 4 This is a schematic diagram illustrating the structural composition of an embodiment of a file freezing device based on direct access to a device provided by the present invention. Figure 4 As shown, this file freezing device based on direct access to the device, applied to virtual machines in a semi-virtualized scenario, includes:
[0057] The first acquisition module 401 is used to send an access request to the backend direct access device in the second operating system through the frontend direct access device in the first operating system running on the virtual machine, receive the response from the backend access device, and acquire any pass-through file in the second operating system.
[0058] The second acquisition module 402 is used to obtain all transparent files in the first operating system based on any one transparent file by directly accessing the device through the front end.
[0059] The sending module 403 is used to determine the pass-through files that have not been written to disk in all pass-through files through the front-end direct access device, and send a write request to the back-end direct access device to write the pass-through files that have not been written to disk to disk.
[0060] The writing module 404 is used to respond to a write request by directly accessing the device from the backend, write the pass-through file that has not been written to the disk to the disk, and notify the frontend access device.
[0061] Setting module 405 is used to set a stop-write flag for the front-end directly accessed device;
[0062] Suspension module 406 is used to suspend the pass-through file being written to the disk.
[0063] Optionally, the second acquisition module 402 includes:
[0064] The first acquisition unit is used to obtain the superblock corresponding to the file system in the first operating system based on any transparent file by directly accessing the device through the front end.
[0065] The second acquisition unit is used to acquire all transparent files based on the linked list of the superblock.
[0066] Optionally, the sending module 403 includes:
[0067] The first sending unit is used to send a write request to the backend direct access device to write the file data of the pass-through file that has not been written to the disk to the disk.
[0068] The second sending unit is used to send a request to the backend direct access device to write the metadata of the pass-through file that has not yet been written to the disk to the disk.
[0069] Optionally, the file freezing device based on direct access to the device further includes:
[0070] The conversion module is used to convert the file format of all pass-through files into a file format compatible with the file system of the second operating system by mounting it on the Fuse server side of the second operating system.
[0071] Optionally, the conversion module includes:
[0072] The sending unit is used to transmit all transparent files to the Fuse server based on a preset protocol via the Fuse client mounted on the first operating system.
[0073] The conversion unit is used to convert the file format of all pass-through files to a file format compatible with the file operating system of the second operating system via the Fuse server.
[0074] Optionally, the file freezing device based on direct access to the device further includes:
[0075] The third acquisition module is used to acquire the front-end direct access device in the first operating system based on a preset framework.
[0076] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 The electronic device may include a processor 501, a communications interface 502, a memory 503, and a communication bus 504. The processor 501, communications interface 502, and memory 503 communicate with each other via the communication bus 504. The processor 501 can invoke logical instructions in the memory 503 to execute the following methods: sending an access request to a backend direct access device in a second operating system running on a computer via a frontend direct access device in a first operating system running on a virtual machine; receiving a response from the backend direct access device; obtaining any pass-through file in the second operating system; obtaining all pass-through files in the first operating system based on any one pass-through file via the frontend direct access device; identifying pass-through files not yet written to disk via the frontend direct access device; sending a write request to the backend direct access device to write the unwritten pass-through files to disk; the backend direct access device responding to the write request by writing the unwritten pass-through files to disk and notifying the frontend access device; setting a stop-write flag on the frontend direct access device; and suspending the write of pass-through files to disk.
[0077] Furthermore, the logical instructions in the aforementioned memory 503 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0078] On the other hand, embodiments of the present invention also provide a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer can execute the file freezing method based on a direct access device provided in the above embodiments, for example including: sending an access request to a backend direct access device in a second operating system running on a computer through a frontend direct access device in a first operating system running on a virtual machine, receiving a response from the backend direct access device, and obtaining any one pass-through file in the second operating system; obtaining all pass-through files in the first operating system based on any one pass-through file through the frontend direct access device; determining, through the frontend direct access device, pass-through files that have not been written to disk among all pass-through files, and sending a write request to the backend direct access device to write the pass-through files that have not been written to disk to disk; responding to the write request, the backend direct access device writes the pass-through files that have not been written to disk to disk and notifies the frontend access device; setting a stop-write flag for the frontend direct access device; suspending the pass-through files to disk.
[0079] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the file freezing method based on a direct access device provided in the above embodiments, which includes, for example,: sending an access request to a backend direct access device in a second operating system running on a computer via a frontend direct access device in a first operating system running on a virtual machine, receiving a response from the backend direct access device, and obtaining any one pass-through file in the second operating system; obtaining all pass-through files in the first operating system based on any one pass-through file via the frontend direct access device; determining, via the frontend direct access device, pass-through files that have not been written to disk among all pass-through files, and sending a write request to the backend direct access device to write the pass-through files that have not been written to disk to disk; responding to the write request via the backend direct access device, writing the pass-through files that have not been written to disk to disk, and notifying the frontend access device; setting a stop-write flag for the frontend direct access device; and suspending the pass-through files to be written to disk.
[0080] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be separate, and the components shown as modules may or may not be second modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0081] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A file freezing method based on direct device access, applied to virtual machines in a semi-virtualized scenario, characterized in that... include: By using the front-end direct access device in the first operating system running on the virtual machine, an access request is sent to the back-end direct access device in the second operating system running on the computer, and the response from the back-end direct access device is received to obtain any pass-through file in the second operating system. The device can directly access all transparent files in the first operating system based on any one of the transparent files through the front end. The front-end direct access device identifies the pass-through files that have not been written to disk in all pass-through files, and sends a write request to the back-end direct access device to write the pass-through files that have not been written to disk to the disk. The backend direct access device responds to the write request by writing the pass-through file that has not been written to the disk to the disk, and notifies the frontend direct access device. Set a stop-write flag for the front-end direct access device; Suspend the pass-through file being written to the disk; The step of obtaining all transparent files in the second operating system based on any one of the transparent files by directly accessing the device through the front end includes: The device can directly access the file system corresponding to the superblock in the first operating system based on any one of the transparent files through the front end. All transparent files are obtained based on the linked list of the superblock.
2. The file freezing method based on direct access to a device according to claim 1, characterized in that, Sending a write request to the backend direct access device to write the pass-through file that has not yet been written to the disk to the disk includes: Send a write request to the backend direct access device to write the file data of the pass-through file that has not been written to the disk to the disk; Send a request to the backend direct access device to write the metadata of the pass-through file that has not been written to the disk to the disk.
3. The file freezing method based on direct access to a device according to claim 1, characterized in that, Before the method of directly accessing the device through the front end to determine the pass-through files that have not been written to disk in all pass-through files, it also includes: The file format of all the pass-through files is converted to a file format compatible with the file system of the second operating system by mounting the Fuse server on the second operating system.
4. The file freezing method based on direct access to a device according to claim 3, characterized in that, The step of converting the file format of all the transparently transmitted files to a file format compatible with the file operating system of the second operating system by mounting the Fuse server on the second operating system includes: The Fuse client mounted on the first operating system transmits all the transparent files to the Fuse server based on a preset protocol; The Fuse server converts all the transparent files into a file format compatible with the file operating system of the second operating system.
5. The file freezing method based on direct access to a device according to claim 1, characterized in that, Before issuing an access request from a front-end direct access device in a first operating system running on the virtual machine to a back-end direct access device in a second operating system, the method further includes: The front-end direct access device is obtained in the first operating system based on a preset framework.
6. A file freezing device based on direct access to the device, applied to virtual machines in a semi-virtualized scenario, characterized in that, include: The first acquisition module is used to send an access request to a backend direct access device in a second operating system through a frontend direct access device in a first operating system running on the virtual machine, receive a response from the backend direct access device, and acquire any one of the pass-through files in the second operating system. The second acquisition module is used to acquire all transparent files in the first operating system based on any one transparent file through the front-end direct access device, including: acquiring the superblock corresponding to the file system in the first operating system based on any one transparent file through the front-end direct access device; and acquiring all transparent files based on the linked list of the superblock. The sending module is used to determine, through the front-end direct access device, the pass-through files that have not been written to disk in all pass-through files, and send a write request to the back-end direct access device to write the pass-through files that have not been written to disk to disk. The write module is used to respond to the write request through the backend direct access device, write the pass-through file that has not been written to the disk to the disk, and notify the frontend direct access device. The setting module is used to set a stop-writing flag for the front-end direct access device; The suspend module is used to suspend the pass-through file being written to the disk.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the file freezing method based on direct access device as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the file freezing method based on a direct access device as described in any one of claims 1 to 5.
9. A computer program product having executable instructions stored thereon, characterized in that, When executed by the processor, this instruction causes the processor to implement the steps of the file freezing method based on a direct access device as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Control method and device for storage device based on virtual machine
CN110308971A