[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN114661661A - File processing method and device, electronic equipment and storage medium - Google Patents

File processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114661661A
CN114661661A CN202011528178.5A CN202011528178A CN114661661A CN 114661661 A CN114661661 A CN 114661661A CN 202011528178 A CN202011528178 A CN 202011528178A CN 114661661 A CN114661661 A CN 114661661A
Authority
CN
China
Prior art keywords
processed
write
file
file block
mode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011528178.5A
Other languages
Chinese (zh)
Inventor
王玉波
许乐
李华英
王志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN202011528178.5A priority Critical patent/CN114661661A/en
Publication of CN114661661A publication Critical patent/CN114661661A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • G06F16/1824Distributed file systems implemented using Network-attached Storage [NAS] architecture
    • G06F16/183Provision of network file services by network file servers, e.g. by using NFS, CIFS

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a file processing method and device, electronic equipment and a storage medium. The method comprises the following steps: determining a file block to be processed and a write request to be processed from a received message to be processed; determining whether a write-through mode is enabled to execute write processing operation on the file block to be processed; and if the transparent writing mode is determined to be started, performing structural transformation on the index of the file block to be processed, and controlling the CephFS client to directly write the file block to be processed subjected to the structural transformation into a storage device according to the write request to be processed. By adopting the scheme, under the condition that new files are continuously written into the file system and each file cannot be read after being written once in a short time, the CephFS client can support the transparent transmission of the write request from the NFS server by performing structure transformation on the index of the file block to be processed, so that the file block to be processed is directly written into the storage device, and the average response speed and the write efficiency of the file are improved.

Description

File processing method and device, electronic equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of distributed storage, in particular to a file processing method and device, electronic equipment and a storage medium.
Background
A Ceph File System (CephFS) is a distributed File System implemented based on a RADOS architecture, and stores metadata and data of files or directories in respective storage pools in the form of objects. At present, in consideration of compatibility and performance problems of the Cephfs-client, the Cephfs-client is usually embedded into an operating system in a kernel module (ko) form, a VFS compatible interface is provided upwards to receive a request, and a RADOS communication protocol is followed downwards to complete forwarding of a write request and message response processing. However, the above approach, while solving the compatibility and performance issues, requires a higher kernel version, and most devices do not meet this requirement.
Disclosure of Invention
The embodiment of the invention provides a file processing method, a file processing device, electronic equipment and a storage medium, and aims to improve the writing efficiency and response speed of a file and improve the system stability.
In a first aspect, an embodiment of the present invention provides a file processing method, which is applied to an NFS server, where the NFS server is deployed at a front end of a CephFS client, and the method includes:
determining a file block to be processed and a write request to be processed from a received message to be processed;
determining whether a write-through mode is enabled to execute write processing operation on the file block to be processed;
and if the write-through mode is determined to be started, performing structure conversion on the index of the file block to be processed, and controlling the CephFS client to directly write the file block to be processed subjected to the index structure conversion into a storage device according to the write request to be processed.
In a second aspect, an embodiment of the present invention further provides a file processing apparatus configured at an NFS server, where the NFS server is deployed at a front end of a CephFS client, and the apparatus includes:
the message processing module is used for determining a file block to be processed and a write request to be processed from the received message to be processed;
the mode determining module is used for determining whether to enable a write-through mode to execute write processing operation on the file block to be processed;
and the file transparent writing module is used for performing structure conversion on the index of the file block to be processed if the transparent writing mode is determined to be started, and controlling the CephFS client to directly write the file block to be processed subjected to the index structure conversion into the storage device according to the write request to be processed.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
storage means for storing one or more programs;
the one or more programs are executed by the one or more processors, so that the one or more processors implement the file processing method as described in any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the file processing method as described in any of the embodiments of the present invention.
The embodiment of the invention provides a file processing method, which comprises the steps of determining a file block to be processed and a corresponding write request to be processed from a message to be processed after receiving the message to be processed, and judging whether a write-through mode is started to execute write processing operation on the file block to be processed; and if the transparent writing mode is determined to be started, performing structure conversion on the index of the file block to be processed, and controlling the CephFS client to directly write the file block to be processed subjected to the index structure conversion into the storage device according to the write request to be processed. By adopting the scheme, under the condition that new files are continuously written into the file system and each file is written once and cannot be read in a short time, the CephFS client can support the transparent transmission of the write request from the NFS server by structuring the index of the file block to be processed, so that the file block to be processed is directly written into the storage device, and the average response speed and the write efficiency of the file are improved; and moreover, the NFS server proxies the CephFS client to provide services, so that the problem of high requirement on the kernel version of the CephFS client can be avoided on the premise of solving the problems of compatibility and performance.
The above summary of the present invention is only an overview of the technical solutions of the present invention, and the present invention can be implemented in accordance with the content of the description so as to make the technical means of the present invention more clearly understood, and the above and other objects, features, and advantages of the present invention will be more clearly understood.
Drawings
Other features, objects and advantages of the present invention will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, with reference to the accompanying drawings. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic diagram illustrating metadata and data access based on a Ceph file system according to an embodiment of the present invention;
FIG. 2 is a flow chart of a file processing method provided in an embodiment of the present invention;
FIG. 3 is a schematic diagram of an architecture of kernel-mode NFS and CephFS provided in the embodiment of the present invention;
fig. 4 is a schematic diagram of an NFS server proxy CephFS client providing service provided in an embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating mode switching between cache write and write-through according to an embodiment of the present invention;
FIG. 6a is a schematic diagram of a structure based on a kvec format provided in an embodiment of the present invention;
FIG. 6b is a schematic diagram of a structure based on bio _ vec format provided in an embodiment of the present invention;
FIG. 7 is a flowchart illustrating a structure transformation of a file block to be processed according to an embodiment of the present invention;
fig. 8 is a block diagram showing a configuration of a file processing apparatus according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device provided in an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations (or steps) can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
For better understanding of the technical solution of the present application, a brief description is now made of metadata and data of a file or a directory of a Ceph file system, and fig. 1 is a schematic diagram of accessing metadata and data based on the Ceph file system according to an embodiment of the present invention. Referring to fig. 1, for a Ceph file system, a CephFS client cannot directly access a metadata pool, and needs to send a request to a configured MDS process, and the MDS indirectly completes modification of metadata and stores the metadata in the metadata pool. However, the CephFS client can directly read and write objects in the data pool, meaning that modifications on the file content need not be done via other processes.
Currently, there are several main implementation schemes for a CephFS client: the first is that a file system operation API interface is provided in the form of a user mode module (so) for a user process to call, and the user program needs to refer to the module when writing, but most file operation programs are written facing to a general system architecture, so that the compatibility of the scheme is poor; second, a ceph fuse process is opened on the user device, which calls the cephfs API. The file operating program of the user still accesses the file system through system call, and the kernel automatically forwards the request to the fuse process to complete the docking work. However, this solution has a severe impact on performance and is not suitable for use in a production environment; thirdly, the kernel module (ko) is embedded into an operating system, a VFS compatible interface is provided upwards to receive the request, and the RADS communication protocol is followed downwards to complete the request forwarding and message response processing. However, the above approach, while solving the compatibility and performance issues, requires a higher kernel version, and most devices do not meet this requirement.
The following embodiments and alternatives thereof will be described in detail with respect to the file processing method, device, electronic device, and storage medium provided in the present application.
Fig. 2 is a flowchart of a file processing method provided in an embodiment of the present invention. The embodiment of the invention can be suitable for the situation of fast writing of the file under the Ceph-based file system. The method can be executed by a file processing device, which can be implemented in software and/or hardware and can be integrated on an electronic device with network communication function. As shown in fig. 2, the file processing method in the embodiment of the present invention may include the following steps:
s210, determining a file block to be processed and a write request to be processed from the received message to be processed.
In this embodiment, fig. 3 is a schematic diagram of an architecture of kernel-mode NFS and CephFS according to an embodiment of the present invention. Referring to fig. 3, in an implementation scheme for a CephFS client, considering the compatibility and performance issues of the CephFS client and the problem that the core version required by the CephFS client is high, but most devices generally do not meet the requirement, an NFS server may be used to proxy the CephFS client to provide services. The NFS server can be deployed at the front end of the CephFS client, and the CephFS client is proxied to provide services through the NFS server, so that user side equipment is not required to have a higher kernel version, and the problem that services cannot be effectively provided due to the fact that most of the equipment cannot meet the requirements is avoided.
In one alternative of this embodiment, combinations may be made with the various alternatives provided in one or more of the embodiments described above. Determining the file block to be processed and the write request to be processed from the received message to be processed may include the following operations:
and analyzing the message to be processed received from the NFS client, and writing the analyzed file block to be processed and the write request to be processed into the temporarily applied data buffer area.
In this embodiment, fig. 4 is a schematic diagram of an NFS server proxy CephFS client providing service provided in an embodiment of the present invention. Referring to fig. 2 and 4, the NFS client may send a to-be-processed packet to the NFS server through Socket communication, and may obtain a to-be-processed file block and a to-be-processed write request carried in the to-be-processed packet by analyzing the to-be-processed packet. The NFS server can temporarily apply for a data buffer area according to the requirement, and put the file block to be processed and the write request to be processed, which are obtained by analysis, into the data buffer area.
S220, determining whether the write-through mode is enabled to execute the write processing operation on the file block to be processed.
In this embodiment, referring to fig. 4, for the Ceph file system, two modes, namely a write-through mode and a cache write mode, may be set to implement write processing of the file block to be processed. The cache writing mode supports that a file to be processed is written into a general file system cache firstly, and then written file blocks to be processed are flushed into the storage device from the general file system cache. And the transparent writing mode supports that the files to be processed with a specific index structure are directly written into the storage device after the index structure conversion is carried out on the files.
In this embodiment, when a new file is continuously written into the file system and the pressure is high enough, the file system does not have enough idle time to flush the cache, the cache is exhausted after a period of time, and at this time, new data is allowed to be continuously written into the cache after the previous dirty data is flushed, so that the response speed is reduced. In addition, when each file is written once and the content cannot be read in a short time, the setting of the cache is not significant, compared with the case of directly writing data into the back-end storage device, the cache writing mode has an additional data copying process, the writing efficiency is reduced, and particularly under the condition that the block size of the file is larger, the influence on the writing efficiency is more obvious. Based on the above situation, the adaptability of the cache write mode and the write-through mode to the scenes is different, and in some scenes, the cache write mode has some defects, so that whether the write-through mode is enabled or not is determined according to the actual situation to realize the write processing operation of the file block to be processed.
In one alternative of this embodiment, combinations may be made with each of the alternatives provided in one or more of the embodiments described above. Wherein, determining whether the write-through mode is enabled to execute the write processing operation on the file block to be processed may include the following steps a1-a 2:
step A1, if it is determined that the file block to be processed is written for the first time, determining the block size of the file block to be processed.
And step A2, if the block size of the file block to be processed is determined to be larger than the preset block size, selecting the write-through mode from the write-through mode and the cache write mode to start the write-through mode to execute the write processing operation on the file block to be processed.
In this embodiment, fig. 5 is a schematic diagram illustrating mode switching between cache writing and write-through according to an embodiment of the present invention. Referring to fig. 5, it may be determined whether the file block to be processed belongs to the initial writing by determining whether a to-be-written position for writing the file block to be processed in the storage device contains valid data. If the position to be written in which the file block to be processed is written in the storage device does not contain valid data, determining that the file block to be processed belongs to initial writing; and if the to-be-written position for writing the to-be-processed file block in the storage device contains valid data, determining that the to-be-processed file block does not belong to the initial writing and is probably the overwriting.
In this embodiment, in the case of overwriting, since there is a possibility of write merge at the CephFS client, it is more efficient to integrate write requests issued multiple times and then issue the write requests once, and at this time, the cache write mode is better than the write-through mode. However, in the case of initial writing, there may be no possibility of write merge in the CephFS client, for example, only one write request needs to be issued; or when the file block is large, only the original write request needs to be issued, and the write-through mode is superior to the cache write mode. Therefore, if the file block to be processed is judged to belong to the initial writing, the block size of the file block to be processed is continued; and if the file block to be processed is judged not to belong to the initial writing, the cache writing mode is directly started.
In the embodiment, when the file block to be processed is small, the data copying cost is low, the response time can be effectively reduced by using the cache write mode, and the efficiency can be improved by merging and issuing. In addition, due to the small overall traffic, the file system has enough free flash cache, and the write-through mode should be abandoned and the cache write mode should be used. Therefore, whether the block size of the file block to be processed is larger than the preset block size or not can be determined, if yes, the write-through mode is selected from the write-through mode and the cache write mode to be started to execute the write processing operation on the file block to be processed, and otherwise, the cache write mode is selected from the write-through mode and the cache write mode to be started to execute the write processing operation on the file block to be processed.
In this embodiment, the preset block size may be a configuration value set according to the write-through performance generated by using the write-through mode for file blocks with different block sizes, for example, the configuration value may be 128K, because block write-through below 128K is hardly improved for the write performance during a mass picture storage test, and block write-through above 128K can improve the write performance by 16% -22%.
And S230, if the transparent writing mode is determined to be started, performing structure conversion on the index of the file block to be processed, and controlling the CephFS client to directly write the file block to be processed subjected to the index structure conversion into the storage device according to the write request to be processed.
In this embodiment, fig. 6a is a schematic diagram based on a kvec format structure provided in an embodiment of the present invention, where in a data buffer temporarily applied by an NFS server, an index of a file block to be processed is given in a kvec format, that is, only a first address and a length of the buffer are given here, and a page covered by the buffer is not specified, whereas when a CephFS client sends a write request to a backend storage, data transmission needs to be performed in units of pages. Therefore, a structural transformation needs to be performed on the index of the file block to be processed, so that the file block to be processed can be directly sent from the buffer applied by the NFS server to the backend storage device for writing.
In this embodiment, fig. 6b is a schematic diagram of a structure based on a bio _ vec format according to an embodiment of the present invention, and a bio _ vec array may be selected as a target conversion format for index structure conversion, where the bio _ vec represents a page paragraph in a form of a page index, a segment length, and an offset in a page, which may meet a requirement for page-based transmission, and the bio _ vec array may support that a file block to be processed is directly sent from a buffer applied by an NFS server to a back-end storage device for writing.
In one alternative of this embodiment, combinations may be made with each of the alternatives provided in one or more of the embodiments described above. Fig. 7 is a flowchart of performing structure transformation on a file block to be processed, where performing index structure transformation on the file block to be processed specifically includes the following steps B1-B2:
and step B1, calculating the page address, the offset in the page and the length of the segment of the file block to be processed of the kvec structure, and inquiring the page according to the page address to obtain the page index of the file block to be processed of the kvec structure.
And step B2, converting the index of the file block to be processed from the kvec structure to the bio _ vec array transmitted by taking the page as a unit based on the calculated page index, the offset in the page and the segment length.
In one alternative of this embodiment, combinations may be made with the various alternatives provided in one or more of the embodiments described above. Wherein, controlling the CephFS client to directly write the file blocks to be processed converted by the index structure into a storage device according to the write request to be processed may include steps C1-C2:
and step C1, issuing a pending write request of the pending file block to the CephFS client through the VFS operation interface.
And step C2, controlling the CephFS client to directly send the file block to be processed converted by the index structure from the NFS server to the storage device for writing through the write request to be processed.
In this embodiment, referring to fig. 4, in the write-through mode, the CephFS client is docked with the NFS server, and the NFS server may perform index structure conversion on the to-be-processed file block in the buffer, and then issue a to-be-processed write request to the CephFS client through the VFS interface. The CephFS client can bypass a flow bottleneck brought by the cache of the file system, and directly sends the file block to be processed converted by the index structure to the storage device for writing according to the write request to be processed.
In this embodiment, referring to fig. 4, in the cache write enabled mode, the NFS server issues a write request to the CephFS client through the VFS interface, data is written into the file system cache, and then the CephFS client returns a write completion message upward. The data will eventually be written to the back-end storage at the appropriate time in the form of a dirty data flush.
By adopting the file processing scheme provided by the embodiment of the application, under the condition that new files are continuously written into the file system and each file is written once and cannot be read in a short time, the CephFS client can support the transparent transmission of the write request from the NFS server by structuring the index of the file block to be processed, so that the file block to be processed is directly written into the storage device, and the response speed and the write efficiency of the file are improved; and the NFS server side provides services for the CephFS client side, so that the problem of high requirement on the kernel version of the CephFS client side can be avoided on the premise of solving the problems of compatibility and performance.
Fig. 8 is a block diagram of a file processing apparatus provided in the embodiment of the present invention. The embodiment of the invention can be suitable for the situation of fast writing of the file under the Ceph-based file system. The file processing device can be realized in a software and/or hardware mode, and can be integrated on an electronic device with a network communication function. As shown in fig. 8, the file processing apparatus in the embodiment of the present invention may include the following: a message processing module 810, a mode determination module 820 and a file write-through module 830. Wherein:
a message processing module 810, configured to determine a file block to be processed and a write request to be processed from a received message to be processed;
a mode determining module 820, configured to determine whether a write-through mode is enabled to perform a write processing operation on the file block to be processed;
the file write-through module 830 is configured to perform structure transformation on the index of the file block to be processed if it is determined that the write-through mode is enabled, and control the CephFS client to directly write the file block to be processed, which is subjected to the structure transformation by the index, into a storage device according to the write request to be processed; the NFS server is deployed at the front end of the CephFS client.
On the basis of the foregoing embodiment, optionally, the message processing module 810 includes:
and analyzing the message to be processed received from the NFS client, and writing the analyzed file block to be processed and the write request to be processed into the temporarily applied data buffer area.
On the basis of the foregoing embodiment, optionally, the mode determining module 820 includes:
if the file block to be processed is determined to be written for the first time, determining the block size of the file block to be processed;
and if the block size of the file block to be processed is larger than the preset block size, selecting a write-through mode from a write-through mode and a cache write mode to start the write-through mode to execute write processing operation on the file block to be processed.
On the basis of the foregoing embodiment, optionally, the file write-through module 830 includes:
calculating the page address, the offset in the page and the segment length of the file block to be processed of the kvec structure, and inquiring the page according to the page address to obtain the page index of the file block to be processed of the kvec structure;
and converting the index of the file block to be processed from the kvec structure to a bio _ vec array transmitted by taking the page as a unit based on the page index, the offset in the page and the segment length.
On the basis of the foregoing embodiment, optionally, the file write-through module 830 includes:
issuing a write request to be processed of the file block to be processed to the CephFS client through a VFS operation interface of a virtual file system;
and controlling the CephFS client to directly send the file blocks to be processed converted by the index structure from the NFS server to a storage device for writing through the write request to be processed.
The file processing apparatus provided in the embodiment of the present invention may execute the file processing method provided in any embodiment of the present invention, and has corresponding functions and beneficial effects for executing the file processing method, and specific processes may refer to the embodiments of the file processing method.
Fig. 9 is a schematic structural diagram of an electronic device provided in an embodiment of the present invention. As shown in fig. 9, the electronic device provided in the embodiment of the present invention includes: one or more processors 910 and storage 920; the processor 910 in the electronic device may be one or more, and one processor 910 is taken as an example in fig. 9; storage 920 is used to store one or more programs; the one or more programs are executed by the one or more processors 910, so that the one or more processors 910 implement the file processing method according to any one of the embodiments of the present invention.
The electronic device may further include: an input device 930 and an output device 940.
The processor 910, the storage 920, the input 930, and the output 940 in the electronic apparatus may be connected by a bus or other means, and fig. 9 illustrates the connection by the bus as an example.
The storage device 920 in the electronic device is used as a computer-readable storage medium for storing one or more programs, which may be software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the file processing method provided in the embodiment of the present invention. The processor 910 executes various functional applications and data processing of the electronic device by executing software programs, instructions and modules stored in the storage 920, that is, implements the file processing method in the above method embodiment.
The storage 920 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device, and the like. Additionally, the storage 920 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the storage 920 may further include memory located remotely from the processor 910, which may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 930 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic apparatus. The output device 940 may include a display device such as a display screen.
And, when the one or more programs included in the electronic device are executed by the one or more processors 910, the programs perform the following operations:
determining a file block to be processed and a write request to be processed from a received message to be processed;
determining whether a write-through mode is enabled to execute write processing operation on the file block to be processed;
and if the transparent writing mode is determined to be started, performing structure conversion on the index of the file block to be processed, and controlling the CephFS client to directly write the file block to be processed subjected to the index structure conversion into a storage device according to the write request to be processed.
Of course, it can be understood by those skilled in the art that when the one or more programs included in the electronic device are executed by the one or more processors 910, the programs may also perform related operations in the file processing method provided in any embodiment of the present invention.
An embodiment of the present invention provides a computer-readable medium, on which a computer program is stored, the program being configured to, when executed by a processor, perform a file processing method, the method including:
determining a file block to be processed and a write request to be processed from a received message to be processed;
determining whether a write-through mode is enabled to execute write processing operation on the file block to be processed;
and if the write-through mode is determined to be started, performing structure conversion on the index of the file block to be processed, and controlling the CephFS client to directly write the file block to be processed subjected to the index structure conversion into a storage device according to the write request to be processed.
Optionally, the program may be further configured to perform a file processing method provided in any embodiment of the present invention when executed by a processor.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read Only Memory (ROM), an Erasable Programmable Read Only Memory (EPROM), a flash Memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. A computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take a variety of forms, including, but not limited to: an electromagnetic signal, an optical signal, or any suitable combination of the foregoing. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, Radio Frequency (RF), etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A file processing method is applied to an NFS server, wherein the NFS server is deployed at the front end of a CephFS client, and the method comprises the following steps:
determining a file block to be processed and a write request to be processed from a received message to be processed;
determining whether a write-through mode is enabled to execute write processing operation on the file block to be processed;
and if the transparent writing mode is determined to be started, performing structure conversion on the index of the file block to be processed, and controlling the CephFS client to directly write the file block to be processed subjected to the index structure conversion into a storage device according to the write request to be processed.
2. The method of claim 1, wherein determining pending file blocks and pending write requests from the received pending message comprises:
and analyzing the message to be processed received from the NFS client, and writing the analyzed file block to be processed and the write request to be processed into the temporarily applied data buffer area.
3. The method of claim 1, wherein determining whether write-through mode is enabled to perform write processing operations on the file block to be processed comprises:
if the file block to be processed is determined to be written for the first time, determining the block size of the file block to be processed;
and if the block size of the file block to be processed is larger than the preset block size, selecting a write-through mode from a write-through mode and a cache write mode to start the write-through mode to execute write processing operation on the file block to be processed.
4. The method according to claim 1, wherein performing index structure transformation on the file block to be processed comprises:
calculating the page address, the offset in the page and the segment length of the file block to be processed of the kvec structure, and inquiring the page according to the page address to obtain the page index of the file block to be processed of the kvec structure;
and converting the index of the file block to be processed from the kvec structure to a bio _ vec array transmitted by taking the page as a unit based on the page index, the offset in the page and the segment length.
5. The method as claimed in claim 1, wherein controlling the CephFS client to write the file block to be processed converted by the index structure directly to a storage device according to the write request to be processed comprises:
issuing a write request to be processed of the file block to be processed to the CephFS client through a VFS operation interface of a virtual file system;
and controlling the CephFS client to directly send the file block to be processed converted by the index structure from the NFS server to a storage device for writing through the write request to be processed.
6. A file processing apparatus configured at an NFS server, the NFS server being deployed at a front end of a CephFS client, the apparatus comprising:
the message processing module is used for determining a file block to be processed and a write request to be processed from the received message to be processed;
the mode determining module is used for determining whether to enable a write-through mode to execute write processing operation on the file block to be processed;
and the file transparent writing module is used for performing structure conversion on the index of the file block to be processed if the transparent writing mode is determined to be started, and controlling the CephFS client to directly write the file block to be processed subjected to the index structure conversion into the storage device according to the write request to be processed.
7. The apparatus of claim 6, wherein the mode determination module comprises:
if the file block to be processed is determined to be written for the first time, determining the block size of the file block to be processed;
and if the block size of the file block to be processed is larger than the preset block size, selecting a write-through mode from a write-through mode and a cache write mode to start the write-through mode to execute write processing operation on the file block to be processed.
8. The apparatus of claim 6, wherein the file write-through module comprises:
issuing a write request to be processed of the file block to be processed to the CephFS client through a VFS operation interface of a virtual file system;
and controlling the CephFS client to directly send the file block to be processed converted by the index structure from the NFS server to a storage device for writing through the write request to be processed.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the file processing method of any one of claims 1-5.
10. A computer-readable storage medium on which a computer program is stored, characterized in that the program, when executed by a processor, implements the file processing method of any one of claims 1 to 5.
CN202011528178.5A 2020-12-22 2020-12-22 File processing method and device, electronic equipment and storage medium Pending CN114661661A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011528178.5A CN114661661A (en) 2020-12-22 2020-12-22 File processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011528178.5A CN114661661A (en) 2020-12-22 2020-12-22 File processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114661661A true CN114661661A (en) 2022-06-24

Family

ID=82025133

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011528178.5A Pending CN114661661A (en) 2020-12-22 2020-12-22 File processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114661661A (en)

Similar Documents

Publication Publication Date Title
CN107870728B (en) Method and apparatus for moving data
CN108090078B (en) Document online preview method and device, storage medium and electronic equipment
US20140067920A1 (en) Data analysis system
WO2021013243A1 (en) Method for starting mini program, device, and computer storage medium
CN110365796B (en) Service request processing method and device
CN114296646B (en) Caching method and device based on IO service, server and storage medium
WO2021098260A1 (en) Data deletion method, system and device, and computer readable storage medium
CN112632069A (en) Hash table data storage management method, device, medium and electronic equipment
CN114385091A (en) Method and device for realizing network disk drive character, network disk and storage medium
CN111881394B (en) Request processing method and system for application middle layer
US9891929B2 (en) System and method for redirecting input/output (I/O) sequences
CN115374046B (en) Multiprocessor data interaction method, device, equipment and storage medium
CN111770043B (en) Game data communication method, device, storage medium and electronic equipment
WO2014100954A1 (en) Method and system for data controlling
CN114661661A (en) File processing method and device, electronic equipment and storage medium
CN113296691B (en) Data processing system, method and device and electronic equipment
CN110858238B (en) Data processing method and device
US9069821B2 (en) Method of processing files in storage system and data server using the method
CN114416690B (en) Data migration apparatus, method and storage medium for storing file to object storage
US8171067B2 (en) Implementing an ephemeral file system backed by a NFS server
US11379653B2 (en) Rendering method for on-demand loading of PDF file on network
US10877685B2 (en) Methods, devices and computer program products for copying data between storage arrays
CN114610239A (en) Method and device for operating file in portable memory by mobile terminal
CN110730251B (en) Method, device, medium and electronic equipment for analyzing domain name
CN109828720B (en) Data storage method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination