Summary of the invention
The purpose of the present invention is to provide a kind of file creating method, system, device and computer readable storage medium, withINode distributes the time when solving the problems, such as how to reduce document creation.
To achieve the above object, the embodiment of the invention provides following technical solutions:
A kind of file creating method, comprising:
Receive document creation request;
Target backup file and target iNode are distributed in standby pool for the request to create;Wherein, the standby pool packetInclude the backup file that is pre-created and corresponding iNode;
When document creation request originator utilizes the target iNode to complete the read-write operation to the target backup fileWhen, the target iNode is renamed, so that the corresponding current file completed after read-write operation of the target iNode.
Optionally, described when document creation request originator is completed using the target iNode to the spare text of the targetWhen the read-write operation of part, after being renamed to the target iNode, further includes:
New backup file and corresponding iNode are created, and the new backup file is added to corresponding iNodeThe standby pool.
Optionally, the backup file in the standby pool is stored in caching with corresponding iNode.
Optionally, the backup file in the standby pool is under collapse directories.
Present invention also provides a kind of file creating systems, comprising:
Receiving module, for receiving document creation request;
Distribution module, for distributing target backup file and target iNode in standby pool for the request to create;ItsIn, the standby pool includes the backup file that is pre-created and corresponding iNode;
Renamer module, for utilizing target iNode completion standby to the target when document creation request originatorWhen with the read-write operation of file, the target iNode is renamed, so that the target iNode is corresponding to complete read-write behaviourCurrent file after work.
Optionally, the system also includes:
Creation module, for creating new backup file and corresponding iNode, and by the new backup file with it is correspondingINode be added to the standby pool.
Optionally, the backup file in the standby pool is stored in caching with corresponding iNode.
Optionally, the backup file in the standby pool is under collapse directories.
Present invention also provides a kind of document creation devices, comprising:
Memory, for storing computer program;
Processor is realized when for executing the computer program such as the step of the file creating method.
Present invention also provides a kind of computer readable storage mediums, which is characterized in that the computer-readable storage mediumIt is stored with computer program in matter, the step such as the file creating method is realized when the computer program is executed by processorSuddenly.
By above scheme it is found that a kind of file creating method provided by the invention, comprising: receive document creation request;Target backup file and target iNode are distributed in standby pool for the request to create;Wherein, the standby pool includes creating in advanceThe backup file built and corresponding iNode;When document creation request originator is completed using the target iNode to the targetWhen the read-write operation of backup file, the target iNode is renamed, so that the target iNode is corresponding to complete read-writeCurrent file after operation.
It can be seen that a kind of file creating method provided by the present application, be pre-created multiple backup files with it is correspondingINode, receive document creation request after, no longer need to re-create iNode, it is only necessary to by a file with it is correspondingINode returns to client, can save the time of iNode creation, can also be with even if having heap file request to createThe creation of file is rapidly completed, saves the plenty of time, improves the performance of file system.Present invention also provides a kind of filesAbove-mentioned technical effect equally may be implemented in creation system, device and computer readable storage medium.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, completeSite preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based onEmbodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every otherEmbodiment shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a kind of file creating method, system, device and computer readable storage mediums, with solutionINode distributes the problem of time when certainly how to reduce document creation.
Referring to Fig. 1, a kind of file creating method provided in an embodiment of the present invention is specifically included:
S101 receives document creation request.
Specifically, when client needs to create a file to file system, file wound can be sent by mds into file systemRequest is built, mds receives this document request to create.
S102 distributes target backup file and target iNode for the request to create in standby pool;Wherein, described standbyIt include the backup file that is pre-created and corresponding iNode with pond.
In the present solution, the file of preset quantity is pre-created as spare, and iNode is distributed in advance.These filesIt is stored in standby pool with corresponding iNode.
After receiving document creation request, mds determined directly in standby pool file being pre-created andINode, and return to request to create initiator the operation such as is written and read to file.It should be noted that being read and write in fileBefore, all rigid files for completing creation be it is identical, after the completion of file is created, then modify in the file information and iNodeMetadata information.
S103 completes the read-write to the backup file using the target iNode when document creation request originator and graspsWhen making, the target iNode is renamed, so that the corresponding current file completed after read-write operation of the target iNode.
Specifically, when document creation request originator to target backup file complete read-write operation after, to target iNode intoRow renaming.It should be noted that renaming is that mds modifies iNode attribute, renaming operation here only carries out rename and refers toIt enables, in iNode, executes the attribute informations such as rename instruction and modification filename, file address, make current target iNodeFor the file after corresponding completion read-write operation.
In a specific embodiment, described when document creation request originator is completed using the target iNodeWhen to the read-write operation of the target backup file, after being renamed to the target iNode, further includes:
New backup file and corresponding iNode are created, and the new backup file is added to corresponding iNodeThe standby pool.
In order to avoid the iNode being pre-created has been assigned in this programme, after receiving new document creation requestThe creation for needing to wait iNode as the prior art, in the present solution, whenever there is backup file to be divided with corresponding iNodeAfter matching, new backup file and corresponding iNode are just re-created, is saved in standby pool.It should be noted that thinking standby poolThe operation of the new backup file and corresponding iNode of middle creation and from standby pool taking-up target backup file with it is correspondingINode, the operation for distributing to requesting party can carry out simultaneously.
In a specific embodiment, the backup file in the standby pool is stored in slow with corresponding iNodeIn depositing.
In the present solution, in order to complete the distribution of backup file and iNode as early as possible, in the buffer by standby pool storage, noRule operation is carried out, the speed for reading backup file and iNode in the buffer can faster, therefore be completion document creation requestTime is also just faster.
In a specific embodiment, the backup file in the standby pool is under collapse directories.
It should be noted that due to the data in standby pool be not user creation file and iNode, in order to avoid withFamily operating mistake, standby pool is stored under collapse directories, makes client i.e. requesting party that can not directly find the meshIt records and gets corresponding file and iNode.
It can be seen that a kind of file creating method provided by the embodiments of the present application, be pre-created multiple backup files with it is rightThe iNode answered, receive document creation request after, no longer need to re-create iNode, it is only necessary to by a file with it is correspondingINode returns to client, can save the time of iNode creation, can also be with even if having heap file request to createThe creation of file is rapidly completed, saves the plenty of time, improves the performance of file system.
A kind of file creating system provided by the embodiments of the present application is introduced below, a kind of file wound described belowBuilding system can be cross-referenced with above-described embodiment.
Referring to fig. 2, a kind of file creating system provided by the embodiments of the present application, specifically includes:
Receiving module 201, for receiving document creation request.
Distribution module 202, for distributing target backup file and target iNode in standby pool for the request to create;Wherein, the standby pool includes the backup file that is pre-created and corresponding iNode.
Renamer module 203, for being completed using the target iNode to the target when document creation request originatorWhen the read-write operation of backup file, the target iNode is renamed, so that the target iNode is corresponding to complete read-writeCurrent file after operation.
In a specific embodiment, the system also includes:
Creation module, for creating new backup file and corresponding iNode, and by the new backup file with it is correspondingINode be added to the standby pool.
In a specific embodiment, the backup file in the standby pool is stored in slow with corresponding iNodeIn depositing.
In a specific embodiment, the backup file in the standby pool is under collapse directories.
The file creating system of the present embodiment is for realizing file creating method above-mentioned, therefore in file creating systemThe embodiment part of the visible file creating method hereinbefore of specific embodiment, for example, receiving module 201, distribution module202, renamer module 203 is respectively used to realize step S101, S102, S103 in above-mentioned file creating method, so, toolBody embodiment is referred to the description of corresponding various pieces embodiment, and details are not described herein.
Present invention also provides a kind of document creation devices, referring to Fig. 3, a kind of document creation provided in an embodiment of the present inventionThe structure chart of device, as shown in Figure 3, comprising:
Memory 100, for storing computer program;
Step provided by above-described embodiment may be implemented in processor 200 when for executing the computer program.
Specifically, memory 100 includes non-volatile memory medium, built-in storage.Non-volatile memory medium storageThere are operating system and computer-readable instruction, which is that the operating system and computer in non-volatile memory medium canThe operation of reading instruction provides environment.Processor 200 provides calculating and control ability for document creation device, may be implemented above-mentionedStep provided by one file creating method embodiment.
On the basis of the above embodiments, preferably, the data acquisition equipment further include:
Input interface 300 is controlled through processor and is saved for obtaining computer program, parameter and the instruction of external importingInto memory.The input interface 300 can be connected with input unit, receive parameter or instruction that user is manually entered.This is defeatedEntering device can be the touch layer covered on display screen, be also possible to the key being arranged in terminal enclosure, trace ball or Trackpad,It is also possible to keyboard, Trackpad or mouse etc..
Display unit 400, the data sent for video-stream processor.The display unit 400 can be the display in PC machineScreen, liquid crystal display or electric ink display screen etc..
The network port 500, for being communicatively coupled with external each terminal device.Skill is communicated used by the communication connectionArt can be cable communicating technology or wireless communication technique, as mobile high definition chained technology (MHL), universal serial bus (USB),High-definition media interface (HDMI), Bluetooth Communication Technology, the low-power consumption bluetooth communication technology, is based on adopting wireless fidelity technology (WiFi)The communication technology etc. of IEEE802.11s.
Present invention also provides a kind of computer readable storage mediums, are stored thereon with computer program, the computerStep provided by above-described embodiment may be implemented when program is executed by processor.The storage medium may include: USB flash disk, movementHard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory,RAM), the various media that can store program code such as magnetic or disk.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with otherThe difference of embodiment, the same or similar parts in each embodiment may refer to each other.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention.Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined hereinGeneral Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the inventionIt is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase oneThe widest scope of cause.