Background technology
File system is to depend on a kind of file management of media store medium and the software systems of file storage.In the system of reality, generally all be between operating system and the application program, be the basis that application program realizes the Miscellaneous Documents operation, also be the bridge of linking up the abstract file and the hardware store unit of reality.In current nearly all computer system, file system is widely used.As long as computer system has been installed operating system, in this system, file system must just be installed equally so.
In general system, file system and disk partition are one to one, that is: each subregion all has the file system of oneself, and the data content on all these subregions all is to handle according to the organizational form and the storage mode of this document system.File system then also provides a fixing interface to last, like the modular system calling interface, so that call on the upper strata.
Yet, in some system, require there is the mechanism of a multiple file system of subregion, here, so-called subregion is meant one section storage area set adopting identical data organization mode, at physics and in logic, this storage area all is continuous.There is following characteristic in this system:
1. it is consistent that many file system are stored the form of data on storage medium, but its implementation is inconsistent, and particularly their interfaces that the upper strata is provided are inconsistent, and possess irreplaceability between this two group interface;
2. many data contents that file system can be visited same address;
3. the interface to the upper strata that many files provided also is different on hierarchical relationship, and the interface that has a file system is at the operating system user's space, and the interface of another file system is in the situation in operating system nucleus space.
For example, in system as shown in Figure 1, exist UDF 1 file system 101 and UDF2 file system 102 respectively.Although the final disk partition 103 that they are visited is identical with the driver that calls 104, to different application, the UDF2 file system interface finally provides the system call interfaces 106 of kernel, is in the kernel spacing separately; The UDF1 file system interface then provides application layer API105, and this API is in user's space, and the visit disk partition simultaneously can also be through the 105 visit disk partition of UDF1 file system interface, and this interface and system call interfaces 106 are inconsistent.
Said system is having only a file system to be used, and another is when synchronization comes into operation, can correct execution.If but a plurality of file system invoked situation simultaneously appearred in system, system will produce conflict so.When two different files systems visit same physical disk piece simultaneously, the file access of follow-up execution operation will influence the disk operating result of front.For example, for the disk block of same address, the data content that follow-up write operation has write before covering, thereby make the loss of data that writes of front, thus destroyed the execution result of file operation.
The object of the invention is to solve the interoperable technology barrier of a plurality of file system at a subregion, particularly is directed against the solution of multifile system write conflict.
Summary of the invention
The objective of the invention is to; Certain applications to the shared subregion of a plurality of file system; Solve the collision problem that these a plurality of file system are worked simultaneously and can be produced; A plurality of file system interface visit regulating devices in a kind of same disk partition are provided, and said a plurality of file system comprise: one first file system, for being positioned at the file system of inner nuclear layer; With at least one second file system, for being positioned at the file system of client layer, said regulating device has: synchronization module is used to coordinate the operation of each file system in the said disk partition.
According to a plurality of file system interface visit regulating devices in the same disk partition of another embodiment of the present invention; When any file system in said a plurality of file system is used; Said synchronization module is operated as follows: detect step, whether synchronization module detection computations machine system is in and writes Disk Mode when program is carried out; Allowing step, said computer system is non-ly to allow said program to carry out when writing Disk Mode; The protection step if the said program that is performed comprises write operation, then is changed to said computer system and writes Disk Mode; Synchronizing step, comprise the said program of write operation in execution after, synchronization module upgrades the alternative document system in the said a plurality of file system in the said disk partition.
According to a plurality of file system interface visit regulating devices in the same disk partition of another embodiment of the present invention; Said synchronization module is the file synchronization module; And be positioned at the upper strata of each file system in the said disk partition, said file synchronization module is used to coordinate each file system in the said disk partition to the operation of identical file.
According to a plurality of file system interface visit regulating devices in the same disk partition of another embodiment of the present invention; Said synchronization module is the disk access bridge module; And be positioned at the lower floor of each file system in the said disk partition, said disk access bridge module is used to coordinate each file system in the said disk partition to the operation of same disk block.
According to a plurality of file system interface visit regulating devices in the same disk partition of another embodiment of the present invention, said first file system is the UDF file system, and said second file system is the iVDR file system.
The present invention also aims to provide a plurality of file system interface access methods in a kind of same disk partition, said a plurality of file system comprise: one first file system, for being positioned at the file system of inner nuclear layer; With at least one second file system; For being positioned at the file system of client layer; Has synchronization module between said a plurality of file system; When any file system in said a plurality of file system was used, said method comprised step: detect step, whether synchronization module detection computations machine system is in and writes Disk Mode when program is carried out; Allowing step, said computer system is non-ly to allow said program to carry out when writing Disk Mode; The protection step if the said program that is performed comprises write operation, then is changed to said computer system and writes Disk Mode; Synchronizing step, comprise the said program of write operation in execution after, synchronization module upgrades the alternative document system in the said a plurality of file system in the said disk partition.
According to a plurality of file system interface access methods in the same disk partition of another embodiment of the present invention; Said synchronization module is the file synchronization module; And be positioned at the upper strata of each file system in the said disk partition, said file synchronization module is used to coordinate each file system in the said disk partition to the operation of identical file.
According to a plurality of file system interface access methods in the same disk partition of another embodiment of the present invention; Said synchronization module is the disk access bridge module; And be positioned at the lower floor of each file system in the said disk partition, said disk access bridge module is used to coordinate each file system in the said disk partition to the operation of same disk block.
According to a plurality of file system interface access methods in the same disk partition of another embodiment of the present invention, said first file system is the UDF file system, and said second file system is the iVDR file system.
According to a plurality of file system interface access means and the method in the same disk partition of the present invention; The file operation that can protect positive conducting disk to write; Make other disk operating that possibly destroy file content during this period not to be performed; Thereby guaranteed exclusivity to the corresponding disk space of file; Because it is synchronous that all file operations are all carried out through synchronization module, guaranteed that the file access under the multifile system is synchronous, thereby avoided the generation of data collision.The present invention has solved a plurality of file system issuable data collision problem of working simultaneously effectively.
Embodiment
Following with reference to description of drawings the 1st embodiment of the present invention.
Fig. 2 is the structural representation of the said system of present embodiment.
The illustrated bottom is disk partition 207, and it is a part of space of whole physical disk medium.Based on being that disk unit drives 206 on this disk partition, the effect of device drive layer is to drive physical disk work through instruction mode, makes disk correctly to realize reading, and writes, and operation such as wipes.File system layer is based on the disk drive layer, and the disk access interface that utilizes the disk drive layer to provide is operated the bottom disk.The effect of file system layer is to be the concrete data in magnetic disk according to organized with the file conversion with abstract meaning.In system as herein described, there are 2 different files systems.Here so-called difference is mainly reflected in:
File system on the interface API that provides different.
2. the level at file system internal processing program place is different.
In system shown in Figure 2, file system 1 module 204 in left side is the file system that are in client layer, and it realizes disk access through the interface that disk drive provides, and the last API of application layer that then provides is kept supplying a layer application call; File system 2 modules 205 in right side are the file system that are in inner nuclear layer; The internal interface that it has directly utilized disk drive to provide is realized disk access; To last then be system call through standard; Application program to client layer provides file operation, sees from its structure, and the last lower interface of file system 2 modules is all accomplished at inner nuclear layer with concrete the realization.
On two file system, be the regulating device that is used for the coordinative file operation, it has file synchronization module 203.In addition, this document synchronization module is close on the file system layer.Simultaneously, in this system, file synchronization module 203 upwards provides many group interfaces function, and all file operations can be independently accomplished in the set of every group interface function, and the function that each group interface function is accomplished then is identical, or similarly.
On file system application layer, because original multifile system supports the file of multiple interfaces to call.Therefore, the same file of multiple file interface of supporting of system that adds file synchronization module 203 calls.That is:
1. application 1 module 201 is operated through the interface function collection indirect call file system 1 of file synchronization module 203.All file operations relevant with application 1 finally must be fallen in file system 1 module, and can not fall the alternative document system module, in file system 2.
2. application 2 module 202 is operated through the interface function collection indirect call file system 2 of file synchronization module 203.All file operations relevant with application 2 finally must be fallen in file system 2 modules, and can not fall in the alternative document system module.
The concrete course of work of following supporting paper synchronization module 203:
Calling file operation 301 with application 1 is example, and at first file access requires from application 1, to produce, and this access request is imported file synchronization inside modules 302 into through the interface function collection that file synchronization module 203 provides; The file synchronization module is when the access request of receiving from application 1; Whether the inspection Status Flag " writes " is true 303 (detection steps); This Status Flag has been represented and has been come from other application interface functions and be in the disk write operation; Disk write operation described here is file write operation only not only, also comprises file synchronization simultaneously, and directory creating etc. write relevant operation with data in magnetic disk.If there is the disk write operation, program is directly returned so, its rreturn value representative " disk is busy "; If the current disk write operation that does not come from alternative document operation-interface function, the disk operating request is passed in file system 1 module so, carries out actual file operation (permission step); But before the disk operating request is transmitted, the 203 advanced style of writing part access type inspections 304 of file synchronization module; If the file access from application 1 is the operation 306 that a disk reads type; File synchronization inside modules 203 is not carried out any other operation so; Directly access request and parameter thereof are delivered on the actual file system 1; File system 1 is back to file synchronization module 203 after reading associative operation 308 through inter-process completion actual file; What file synchronization module 203 was not treated turns back to this rreturn value in the calling of application 1 of last layer once more, with this, has accomplished whole file access operation; If the file access from this application 1 is the operation (comprising the disk operating of reading simultaneously and writing) that a disk writes type; File synchronization module 203 inside will be provided with the Status Flag 305 of " writing " so, in order to the illegal operation (protection step) in this stage of the file operation function that stops other application, through this Status Flag; The visit during this period of alternative document handling function will be returned " disk is busy "; After zone bit was set, the file synchronization module was continuing to call actual file operation 307, and this operation can be fallen in the file operation that file system 1 module provides equally; And that carries out reality writes relevant operation 308 with disk; After being finished, return, rreturn value is got back in the file synchronization module, at this moment once more; The file synchronization module does not directly return this value to the last layer application layer; But carry out an extra operation---disk is synchronous 309, and so-called disk synchronous operation is meant that the mirror image data with disk in the internal memory upgrades, and makes in the internal memory with the corresponding data of disk to be consistent (synchronizing steps).After disk synchronous operation was finished, module returned aforementioned rreturn value to last layer, thereby accomplished this write operation.In said process, the processing of file synchronization module respective file itself is transparent,, data itself is not done any processing in the delivery applications layer data that is, even mistake has taken place the data of actual transfer, also can not influence transmission itself.
The execution flow process of application program from the file operation of application 1 initiation more than described.For the file operation process of being initiated by application 2, the mode of its processing is identical, and just the data of file access have dropped in the file system 2.
The write access to file f ile1.txt with reality is an example; Fig. 4 has shown the storage condition of file1.txt at real system; This system exists 2 the file system iVDR_FS (405) and the UDF (407) that share same disk partition; Wherein, IVDR_FS is that Hitachi is proprietary iVDR (the Information of Versatile Disk for Removable usage) file system that hard disk is developed, and it is positioned at the user's space of total system, keeps supplying a layer application call through the application programming interfaces of client layer; And UDF is to be widely used in general compact disk file system by unified disk format (Universal Disc Format).Can see that from figure file f ile1.txt has taken the fixing address space 411 of a fragment position in the subregion 410 of disk 409.All are to the operation that is reflected as on the disk this sector address space that operates in of file1.txt.File system is through ATA (Advanced Technology Attachment) order set visit disk, and this document has different mirror images in the different files system.Among the figure, in file system iVDR_FS (404), exist file1.txt memory mirror 405, and in file system UDF (406), exist file1.txt memory mirror 407 equally, and these 2 file1.txt mirror images are fully independently.When application 1 (401) when carrying out write operation; Application 2 asks file1.txt is carried out write operation (402) simultaneously; At this moment; In the status checking 303 of file synchronization module 403 inside, because Status Flag " writes " set, so the write operation requests of application 2 is returned " disk is busy ".And application 1 is after having carried out normal write operation; File1.txt (405) and actual magnetic disk space 411 state consistencies that the iVDR_FS file system occurs; And file1.txt of UDF file system (407) and the inconsistent situation of actual magnetic disk space 411 states; At this moment; Disk in file synchronization module 403 execution graphs 3 upgrades 309 synchronously, upgrades the file1.txt in the UDF file system with the data of actual magnetic disk space, and the file1.txt file after process is upgraded has kept the consistance with disk space corresponding data 411 equally.After executing all mentioned operations, application 1 returns from the file synchronization module, thereby has accomplished the write operation of application 1 to file1.txt.At this moment; Application 2 calls once more writes file1.txt operation, because Status Flag " write " and was eliminated this moment, therefore can continue downward execution; After having realized writing the file1.txt operation through UDF; Have file synchronization module 403 equally and upgrade the file1.txt file data of iVDR_FS file system, and from the file synchronization module, return application 2, thereby accomplished application 1 and application 2 number of write access operations same file in the renewal back that finishes.
Through the file synchronization module of present embodiment, can when application layer avoids visiting this subregion at the same time from the application program of 2 file system, produce conflict, thereby provide a stable multifile system to share the working method of same subregion.
Following with reference to description of drawings the 2nd embodiment of the present invention.
Fig. 5 is the structural representation of the said system of present embodiment.Comparing the system schematic of the 1st embodiment, mainly is to be used for realizing that the synchronization module that a plurality of file system access are regulated in the position of system variation has taken place.
The illustrated bottom is disk partition 507, and this disk partition upper strata is disk unit and drives 506, and disk unit is the regulating device that is used for the coordinative file operation above driving, and it has disk access bridge module 505.Being a plurality of different levels that are under the jurisdiction of on disk access bridge module 505, the file system 503,504 of distinct interface is provided, on each different files system, then is the application program 501,502 according to the interface customization of respective file system.Disk access bridge module 505 described here is in inner nuclear layer, and what it was inner corresponding is kernel operations, and according to its system architecture, what this module was corresponding all is disk operating, and and be indifferent to file itself.The high-level interface of disk access bridge module serves as according to operating with the disk block address of reality with the disk space that takies.
The concrete course of work of disk access bridge module 505 in the following illustrative system:
File operation with application 1 is an example; At first file access requires from application 1, to produce (601), through the actual file operation of the interface interchange of file system 1, in file system 1; The corresponding file operation is converted into the disk access operation 602 of bottom more; To the read-write of file, in file system, be converted into read-write operation, i.e. disk operating instruction to concrete disk address; The disk operating instruction calls realizes the disk management by synchronization from the intrinsic function 610 of disk access bridge module 505, specifically comprises:
Disk access bridge module 505 checks that at first inner disk writing Status Flag 603 (detection step), if corresponding disk is in write operation, program is directly returned " disk is busy " so; If the current disk write operation that does not come from file system, so actual disk operating instruction is passed in the disk drive, thereby realizes real disk operating (permission step).But before actual disk operational order was transmitted, the disk access bridge module had also been done following processing:
The access type 604 of disk access bridge module 505 judge disk operational orders: if be the operation 605 that a disk reads type from the file access of this application 1; Any other operation is not carried out in disk access bridge module 505 inside so; Directly access instruction and parameter thereof are passed to disk drive; After calling completion, also will be visited thereby accomplished whole file read by transparent upwards transmitting from the rreturn value of disk drive;
If the file access from this application 1 is the operation that a disk writes type; Disk access bridge module 505 inside will be provided with the Status Flag 606 of " writing " so, in order to stop other disk access instructions at this stage visit disk (protection step), after zone bit is set; Disk access bridge module 505 will call disk driver 607; Through disk drive visit disk partition, and carry out actual and disk write operation 608, after being finished, return; Rreturn value is got back to disk access bridge module 505 inside once more; At this moment, disk access bridge module 505 does not directly return rreturn value to the topmost paper system, upgrades 609 synchronously but carry out disk earlier; That is: the memory mirror of each file system that local write operation is corresponding upgrades again, makes in internal memory and the disk this part data of appropriate address be consistent (synchronizing step).After this synchronous operation was finished, disk access bridge module 505 returned aforementioned rreturn value to last layer, thereby accomplished this file write operation.
The execution flow process of application program from the file operation of application 1 initiation more than described.For the file operation process of being initiated by application 2, the mode of its processing is identical.
Fig. 7 example to through a plurality of file system simultaneously to the actual write access of file f ile2.txt.As shown in the figure; System exists 2 the file system iVDRFS (405) and the UDF (407) that share same disk partition 711; Wherein, IVDR FS is that Hitachi is proprietary iVDR (the Informationof Versatile Disk for Removable usage) file system that hard disk is developed, and it is positioned at the user's space of total system, keeps supplying a layer application call through the application programming interfaces of client layer; And UDF is to be widely used in general compact disk file system by unified disk format (Universal Disc Format).
File f ile2.txt has taken the space 711 of one section particular address in the subregion 710 of disk 709.All operations to file2.txt finally all are converted into the operation to this section space of this subregion through file system.There is different mirror images in file f ile2.txt in the different files system.Among Fig. 7, in file system iVDR_FS (704), exist file2.txt memory mirror 703, and in UDF file system (706), exist file2.txt memory mirror 705 equally, and these 2 file2.txt mirror images are fully independently.When application 1 carries out write operation (701); Application 2 asks file2.txt (705) is carried out write operation (702) simultaneously; After write operation requests is passed to file system; File system iVDR_FS and UDF are converted into concrete disk address space to the file of request write operation respectively, and write operation requests is continued to pass to disk access bridge module 707.Therefore, disk access bridge module 707 receives 2 disks with priority and writes request.And in disk access bridge module 707 inside; Because synchronization only allows a disk write operation; Therefore the disk write operation of request will be returned " disk is busy " when its status checking 603 after a while, thereby avoid two disk operating issuable loss of data because of the while.For example, file2 writes request through the disk of iVDR_FS and is taken the lead in carrying out, and file2 is asked through the disk operating of UDF file system in the process of its execution.Then the disk operating through the UDF file system will be returned " disk busy ", and the disk operating through the UDF file system continues upwards to return, in turning back to application 2 after receiving that " disk is busy " returns.And the file2 of process iVDR_FS is after having carried out actual disk write operation; Make file2.txt (703) and actual magnetic disk space 711 state consistencies of iVDR_FS file system, but the file2.txt of UDF file system (705) is inconsistent with actual magnetic disk space 711 states.Therefore; Disk in disk access bridge module 707 execution graphs 6 upgrades 609 synchronously; Upgrade the file2.txt in the UDF file system through the data of actual magnetic disk space, the file2.txt file after process is upgraded has kept the consistance with disk space corresponding data 711 equally.After executing all mentioned operations, the file synchronization module is returned, thereby has accomplished the write operation of application 1 to file2.txt.At this moment; Application 2 can call once more writes the file2.txt operation; Through after the conversion of file to disk space,, therefore can continue downward execution because Status Flag " write " and was eliminated this moment; After having realized writing the file2.txt operation through UDF; Have the file synchronization module equally and upgrade the file2.txt file data of iVDR_FS file system, and from the file synchronization module, return application 2, thereby accomplished application 1 and application 2 number of write access operations same file in the renewal back that finishes.
Disk access bridge module through the said system of present embodiment; 2 pairing application of file system that are in the different levels space of visit can not produce conflict under same subregion, because this disk access bridge module has prevented the unauthorized access of different file to same physical address at bottom through its inter-process logic.Thereby the working method of a shared same subregion of stable multifile system is provided.Because the disk access bridge module is in the more kernel spacing of bottom, therefore compare embodiment 1, the processing speed of present embodiment is rapider, and is littler to taking of system memory resource.
The 3rd embodiment of the present invention below is described.
Fig. 8 is the structural representation of the said system of present embodiment.
The 1st embodiment has showed the problem of avoiding the file access conflict under the condition that has the shared same disk partition of 2 file system.In the present embodiment, exist 3 file system and share same disk partition.Fig. 8 has illustrated said system, than Fig. 2, difference be to increase a file system that is in user's space with and corresponding application layer procedure.Therefore, there are 2 file system program 801,201 and 1 file system programs 202 that are in kernel spacing that are in user's space in native system.File synchronization module 203 is used to coordinate the relevant All Files operation of above-mentioned 3 file system.In native system, file synchronization module 203 upwards provides 3 group interface functions, and all file operations can be independently accomplished in the set of every group interface function, and the function that each group interface function is accomplished then is identical, or similarly.The file synchronization module 203 of described its principle of work of file synchronization module of present embodiment and workflow and embodiment 1 is on all four, and this module is equally applicable to the application system of a plurality of file system.
Through the file synchronization module of the said system of present embodiment, produce conflict in the time of can avoiding the application program of 3 and above file system to visit same disk partition at the same time, thereby guaranteed that a plurality of file system under the same disk partition work simultaneously.