CN107180092A - A kind of control method of file system, device and terminal - Google Patents

A kind of control method of file system, device and terminal Download PDF

Info

Publication number
CN107180092A
CN107180092A CN201710337922.5A CN201710337922A CN107180092A CN 107180092 A CN107180092 A CN 107180092A CN 201710337922 A CN201710337922 A CN 201710337922A CN 107180092 A CN107180092 A CN 107180092A
Authority
CN
China
Prior art keywords
page
snapshot
inode
time
file
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.)
Granted
Application number
CN201710337922.5A
Other languages
Chinese (zh)
Other versions
CN107180092B (en
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.)
Shanghai Institute of Microsystem and Information Technology of CAS
Original Assignee
Shanghai Institute of Microsystem and Information Technology of CAS
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 Shanghai Institute of Microsystem and Information Technology of CAS filed Critical Shanghai Institute of Microsystem and Information Technology of CAS
Priority to CN201710337922.5A priority Critical patent/CN107180092B/en
Publication of CN107180092A publication Critical patent/CN107180092A/en
Application granted granted Critical
Publication of CN107180092B publication Critical patent/CN107180092B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/11File system administration, e.g. details of archiving or snapshots
    • G06F16/128Details of file system snapshots on the file-level, e.g. snapshot creation, administration, deletion
    • 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

Abstract

The present invention provides a kind of control method of file system, device and terminal, and by setting iNode areas, iNode nodes include N ary tree levels digital section, N ary root vertexes fields and snapshot version pointer field;N ary tree constructions data field is set up based on root node page;The chained list directorial area being made up of page index record is set;One physical page in every page index record corresponding data area in order;Form page index chained list, the set for whole old versions that the current version and snapshot that every page indexes a data page in chained list respective file are produced.The present invention sets up the file system based on data link table and N ary tree constructions, realize random storage of the data in amount of physical memory, need not be by Documents Logical order in physical address space sequential storage, the snapshot version of logical data page in file is managed based on chained list, data snapshot and the rollback of file system can be realized, the operational efficiency of file system is improved.

Description

A kind of control method of file system, device and terminal
Technical field
The present invention relates to the technical field of file system, more particularly to a kind of control method of file system, device and Terminal.
Background technology
As the development and IBM of the new memory technology such as NVDIMM, 3D Xpoint are to storage level internal memory (Storage Class Memory, SCM) framework proposition, based on mixing memory system framework and management non-volatile memory NVM turn into research Focus.New memory technology SCM have it is non-volatile, read the features such as write fast, low in energy consumption soon, but still have compared with DRAM a gap, The reliability that cycle life also reduces system is wiped in limited writing.In the prior art, proposed based on new memory technology SCM excessive Plant memory organization mode and optimization method.
With the development of the technologies such as big data, cloud computing, Internet of Things, data just at an unprecedented rate constantly increase and Accumulation.These data how are managed and organized, are a challenge for traditional file system.Although current file system A kind of easy-to-use Method of Data Organization is provided for application, but the Method of Data Organization is the hardware characteristicses based on block device sets Meter, it is impossible to give full play to SCM can random access performance characteristics.Therefore, how data are effectively organized, allows application program energy It is enough to use and access in the way of closer to internal memory, and reliable file system, easy care and the advantage such as shared can be kept, it is maximum Change ground and improve system overall operation efficiency as urgent problem to be solved.
The content of the invention
The shortcoming of prior art in view of the above, it is an object of the invention to provide a kind of controlling party of file system Method, device and terminal, the data that this document system is stored in physical address space are managed using N-ary tree constructions, realize text Number of packages according to random storage in amount of physical memory, without by Documents Logical order in physical address space sequential storage, And the snapshot version of logical data page in file is managed based on chained list, data snapshot and the rollback of file system are realized, so that Substantially improve the overall operational efficiency of file system.
In order to achieve the above objects and other related objects, according to the first aspect of the invention, the embodiment of the present invention provides one The control method of file system is planted, the control method comprises the following steps:
It is provided for storing the iNode areas of iNode nodes, the iNode nodes include N-ary tree levels digital section, N-ary Root vertex field and snapshot version pointer field;Wherein, the N-ary trees level digital section uses N- for storage file The series of ary tree constructions, the N-ary root vertexes field is used for the physical address of storage file root node page, the snapshot Version pointer field is used to point to the snapshot iNode nodes corresponding to the last snapshot of the iNode nodes;
The data field of N-ary tree constructions is set up based on root node page;Wherein, the N-ary trees include any number of Level, last layer level node is stored with the physical address of corresponding next hierarchy node;Last hierarchy node is data Page, other nodes in addition to last described node layer are node page, and the data page and node page are in the number According to area's mixing;
The chained list directorial area being made up of page index record is set;Wherein, every page index record corresponding data area in order A physical page, page index record number is identical with data field number of physical pages;Page index record corresponding to each data page The creation time of the data page and the positional information of last revision data page are stored, so as to form page index chained list, every The set for whole old versions that the current version and snapshot of a data page are produced in page index chained list respective file, for reality The snapshot rollback of existing file.
Alternatively, the iNode nodes also include the iNode nodes information fields for storing its nodal information, the control The step of method also includes updating iNode nodal informations:
Creation time and the system snapshot time of target iNode nodes to be updated are obtained, wherein, during the system snapshot Between for the last snapshot of file system time;
If the creation time of the target iNode nodes is later than the system snapshot time, the target iNode is updated INode nodes information fields in node;Or,
If the creation time of the target iNode nodes is earlier than the system snapshot time, in iNode areas distribution Idle iNode nodes are used as snapshot iNode nodes;The snapshot iNode nodes according to the target iNode node initializings; The snapshot iNode node numbers are preserved in the target iNode nodes, to point to the snapshot iNode nodes, and are updated The iNode nodes information fields of target iNode nodes.
Alternatively, the step of control method also includes updating the data page:
Creation time and the system snapshot time of target data page to be updated are obtained, wherein, the system snapshot time For the time of the last snapshot of file system;
If the creation time of the target data page is later than the system snapshot time, the write-in mesh will be updated the data Mark data page;Or,
If the creation time of the target data page will update the data write-in data field earlier than the system snapshot time Free page, formed new data page;In chained list directorial area, the page index record of new data page is set, and by target data page Positional information and current time write in the page index record of new data page so that the page index note of the new data page Record is inserted into the head of data page chained list;The physical address of new data page is updated onto the corresponding node page of target data page, The node page is set to point to new data page.
Alternatively, the file system includes the snapshot document folder under root folder, and the root folder, described File content under file in addition to snapshot document is pressed from both sides is mapped under the snapshot document folder, and the control method also includes:
When by root folder path access file, the file of current version is read or write;Or,
When pressing from both sides path access file by snapshot document, the iNode nodes of the file are marked;If to the behaviour of file As write-in, refuse information is returned to according to the iNode nodes after mark, write with refusing absolute file;If to file Operate to read, according to the iNode nodes and specified Snapshot time after mark, read latest edition before the specified Snapshot time This file.
Alternatively, when accessing the target data page for the time of specifying, the control method also includes:
From chained list directorial area, search the page corresponding with target data page and index chained list;
From the page index chained list found out, selection is remembered earlier than and with the specified time immediate page index Record;
The positional information in the page index record is extracted, and according to the positional information, updates the target data page Physical address in corresponding node page, so that node page points to the snapshot edition data page corresponding to the time of specifying.
Alternatively, when file to be rolled back to the FileVersion of Snapshot time, the control method also includes:
Close the file of all openings;
Obtain the creation time and erasing time of all iNode nodes in iNode areas;When the creation time of iNode nodes When being later than the Snapshot time, delete and reclaim corresponding iNode nodes;When the erasing time of iNode nodes is later than the snapshot During the time, recover corresponding iNode nodes, and the linking relationship between iNode nodes;
Obtain the creation time of the data page that all pages of index records are preserved in chained list directorial area;When the establishment of data page Between when being later than the Snapshot time, reclaim corresponding data page, and delete in the page index chained list corresponding to data page Page index record;It will be updated earlier than Snapshot time and with the address in the immediate page index record of Snapshot time to the data The node page of page, recovers file to the FileVersion of Snapshot time.
According to the second aspect of the invention, the embodiment of the present invention provides a kind of control device of file system, control dress Put including:
INode areas setup module, the iNode areas for being provided for storing iNode nodes, the iNode nodes include N-ary tree levels digital section, N-ary root vertexes field and snapshot version pointer field;Wherein, the N-ary trees level numeral Section is used for the series that storage file uses N-ary tree constructions, and the N-ary root vertexes field is used for storage file root node The physical address of page, the snapshot version pointer field is used to point to corresponding to the last snapshot of the iNode nodes Snapshot iNode nodes;
Data field setup module, the data field for setting up N-ary tree constructions based on root node page;Wherein, it is described N-ary trees include any number of levels, and last layer level node is stored with the physical address of corresponding next hierarchy node;Finally One hierarchy node is data page, other nodes in addition to last described node layer be node page, the data page and The node page is in the data field mixing;
Chained list directorial area setup module, for setting the chained list directorial area being made up of page index record;Wherein, every page rope Draw a physical page for recording corresponding data area in order, page index record number is identical with data field number of physical pages;Per number The creation time of the data page and the positional information of last revision data page are stored according to the page index record corresponding to page, from And page index chained list is formed, the whole that the current version and snapshot of a data page are produced in every page index chained list respective file The set of old version, the snapshot rollback for realizing file.
Alternatively, the control device also includes iNode nodal information update modules, and the iNode nodes also include depositing The iNode nodes information fields of its nodal information are stored up, the iNode node updates module is used for,
Creation time and the system snapshot time of target iNode nodes to be updated are obtained, wherein, during the system snapshot Between for the last snapshot of file system time;
If the creation time of the target iNode nodes is later than the system snapshot time, the target iNode is updated INode nodes information fields in node;Or,
If the creation time of the target iNode nodes is earlier than the system snapshot time, in iNode areas distribution Idle iNode nodes update the snapshot version pointer field as snapshot iNode nodes;Saved according to the target iNode The point initialization snapshot iNode nodes;The snapshot iNode node numbers are preserved in the target iNode nodes, to point to The snapshot iNode nodes, and more fresh target iNode nodes iNode nodes information fields.
Alternatively, the control device also includes data page update module, is used for,
Creation time and the system snapshot time of target data page to be updated are obtained, wherein, the system snapshot time For the time of the last snapshot of file system;
If the creation time of the target data page is later than the system snapshot time, the write-in mesh will be updated the data Mark data page;Or,
If the creation time of the target data page will update the data write-in data field earlier than the system snapshot time Free page, formed new data page;In chained list directorial area, the page index record of new data page is set, and by target data page Positional information and current time write in the page index record of new data page so that the page index note of the new data page Record is inserted into the head of data page chained list;The physical address of new data page is updated onto the corresponding node page of target data page, The node page is set to point to new data page.
Alternatively, the control device also includes operational control module, wherein, the file system includes root folder, And the snapshot document under the root folder is pressed from both sides, the file content under the root folder in addition to snapshot document is pressed from both sides is mapped to Under the snapshot document folder, the operational control module is used for,
When by root folder path access file, the file of current version is read or write;Or,
When pressing from both sides path access file by snapshot document, the iNode nodes of the file are marked;If to the behaviour of file As write-in, refuse information is returned to according to the iNode nodes after mark, write with refusing absolute file;If to file Operate to read, according to the iNode nodes and specified Snapshot time after mark, read latest edition before the specified Snapshot time This file.
Alternatively, the control device also includes access control module, is used for,
From chained list directorial area, search the page corresponding with target data page and index chained list;
From the page index chained list found out, selection is remembered earlier than and with the specified time immediate page index Record;
The positional information in the page index record is extracted, and according to the positional information, updates the target data page Physical address in corresponding node page, so that node page points to the snapshot edition data page corresponding to the time of specifying.
Alternatively, the control device also includes roll-back module, is used for,
Close the file of all openings;
Obtain the creation time and erasing time of all iNode nodes in iNode areas;When the creation time of iNode nodes When being later than the Snapshot time, delete and reclaim corresponding iNode nodes;When the erasing time of iNode nodes is later than the snapshot During the time, recover corresponding iNode nodes, and the linking relationship between iNode nodes;
Obtain the creation time of the data page that all pages of index records are preserved in chained list directorial area;When the establishment of data page Between when being later than the Snapshot time, reclaim corresponding data page, and delete in the page index chained list corresponding to data page Page index record;It will be updated earlier than Snapshot time and with the address in the immediate page index record of Snapshot time to the data The node page of page, recovers file to the FileVersion of Snapshot time.
According to the third aspect of the invention we, the embodiment of the present invention also provides a kind of terminal, and the terminal includes at least one Processor;And,
The memory being connected with least one described processor communication;Wherein,
The memory storage has can be by the instruction of one computing device, and the instruction is by described at least one Manage device to perform, so that at least one described processor can:
It is provided for storing the iNode areas of iNode nodes, the iNode nodes include N-ary tree levels digital section, N-ary Root vertex field and snapshot version pointer field;Wherein, the N-ary trees level digital section uses N- for storage file The series of ary tree constructions, the N-ary root vertexes field is used for the physical address of storage file root node page, the snapshot Version pointer field is used to point to the snapshot iNode nodes corresponding to the last snapshot of the iNode nodes;
The data field of N-ary tree constructions is set up based on root node page;Wherein, the N-ary trees include any number of Level, last layer level node stores the physical address of corresponding next hierarchy node;Last hierarchy node is data page, Other nodes in addition to last described node layer are node page, and the data page and node page are in the data field Mixing;
The chained list directorial area being made up of page index record is set;Wherein, every page index record corresponding data area in order A physical page, page index record number is identical with data field number of physical pages;Page index record corresponding to each data page The creation time of the data page and the positional information of last revision data page are stored, so as to form page index chained list, every The set for whole old versions that the current version and snapshot of a data page are produced in page index chained list respective file.
As described above, control method, device and the terminal of the file system of the present invention, have the advantages that:Pass through It is provided for storing the iNode areas of iNode nodes, the iNode nodes include N-ary tree levels digital section, N-ary root vertexes Field and snapshot version pointer field;Wherein, the N-ary trees level digital section uses N-ary trees to tie for storage file The series of structure, the N-ary root vertexes field is used for the physical address of storage file root node page, the snapshot version pointer Field is used to point to the snapshot iNode nodes corresponding to the last snapshot of the iNode nodes;Based on root node page Set up the data field of N-ary tree constructions;Wherein, the N-ary trees include any number of levels, and last layer level node is stored with phase The physical address of corresponding next hierarchy node;Last hierarchy node is data page, in addition to last described node layer Other nodes be node page, the data page and the node page in the data field mixing;Set by page index record The chained list directorial area of composition;Wherein, a physical page in every page index record corresponding data area in order, page index record Number is identical with data field number of physical pages;Page index record corresponding to each data page store the creation time of the data page with And the positional information of last revision data page, so that page index chained list is formed, a number in every page index chained list respective file The set of the whole old versions produced according to the current version and snapshot of page.The present invention is established based on data link table and N-ary Tree construction realizes the file system of the random access of quick rollback, and thing is stored in using N-ary tree constructions management file system The data of address space are managed, random storage of the file data in amount of physical memory are realized, without by Documents Logical order In physical address space sequential storage, moreover, the snapshot version of logical data page in file is managed based on chained list, can be efficiently real The data snapshot of existing file system and rollback, so as to improve the operational efficiency of file system.
Brief description of the drawings
Fig. 1 is shown as a kind of structural representation of file system provided in an embodiment of the present invention.
Fig. 2 is shown as a kind of schematic flow sheet of the control method of file system provided in an embodiment of the present invention.
Fig. 3 is shown as a kind of structural representation in iNode areas provided in an embodiment of the present invention.
Fig. 4 is shown as a kind of structural representation of N-ary trees provided in an embodiment of the present invention.
Fig. 5 is shown as a kind of schematic flow sheet of iNode nodal informations update method provided in an embodiment of the present invention.
Fig. 6 is shown as a kind of schematic flow sheet of data page update method provided in an embodiment of the present invention.
Fig. 7 is shown as a kind of schematic diagram of data area structure provided in an embodiment of the present invention.
Fig. 8 is shown as a kind of schematic flow sheet of file access control method provided in an embodiment of the present invention.
Fig. 9 is shown as the principle schematic that a kind of file provided in an embodiment of the present invention and snapshot document are accessed.
Figure 10 is shown as a kind of schematic flow sheet of snapshot document access method provided in an embodiment of the present invention.
Figure 11 is shown as a kind of schematic flow sheet of file rollback method provided in an embodiment of the present invention.
Figure 12 is shown as a kind of structural representation of the control device of file system provided in an embodiment of the present invention.
Embodiment
Illustrate embodiments of the present invention below by way of specific instantiation, those skilled in the art can be by this specification Disclosed content understands other advantages and effect of the present invention easily.The present invention can also pass through specific realities different in addition The mode of applying is embodied or practiced, the various details in this specification can also based on different viewpoints with application, without departing from Various modifications or alterations are carried out under the spirit of the present invention.
Fig. 1 is referred to Figure 12.It should be noted that the diagram provided in the present embodiment only illustrates this in a schematic way The basic conception of invention, only display is with relevant component in the present invention rather than according to package count during actual implement in illustrating then Mesh, shape and size are drawn, and kenel, quantity and the ratio of each component can be a kind of random change during its actual implementation, and its Assembly layout kenel may also be increasingly complex.
The control method of file system in the embodiment of the present invention is based on data link table and N-ary tree constructions realize quick return The control method of the file system of the random access of rolling, physical address is stored in using N-ary tree constructions management file system The data in space, realize random storage of the file data in amount of physical memory, without by Documents Logical order in physics Address space sequential storage.The snapshot version of logical data page in file is managed based on chained list, realizes that the data of file system are fast According to and rollback.
For the control method of file system that the embodiment of the present invention is explicitly described, first in the embodiment of the present invention The structure of file system is illustrated.It is a kind of structural representation of file system provided in an embodiment of the present invention referring to Fig. 1, As shown in figure 1, in an exemplary embodiment, the file system includes setting iNode areas on a memory, chained list area sum According to area, and superblock area and bit map area;Wherein, the superblock area is used for the size, empty and fill up of storage file system The information such as block, the bit map area is used for the use state of memory block.The file system of the embodiment of the present invention is based on said structure The random storage of file data is realized, and realizes data snapshot and the rollback of file system;It should be noted that the present invention is real The control method for applying file system in example can apply to dynamic random access memory and non-volatile RAM unification The storage system of addressing.Moreover, non-volatile RAM includes phase transition storage, resistance-variable storing device, magnetic memory, ferroelectricity Memory etc..
It is a kind of schematic flow sheet of the control method of file system provided in an embodiment of the present invention, such as Fig. 2 referring to Fig. 2 Shown, the embodiment of the present invention shows that processor implements the process of the control method of this document system:
Step S101:It is provided for storing the iNode areas of iNode nodes, the iNode nodes include N-ary tree series Field, N-ary root vertexes field and snapshot version pointer field;Wherein, the N-ary trees level digital section is used to store text Part uses the series of N-ary tree constructions, and the N-ary root vertexes field is used for storage file root node page physically Location, the snapshot version pointer field is used to point to the snapshot iNode sections corresponding to the last snapshot of the iNode nodes Point.
It is a kind of structural representation in iNode areas provided in an embodiment of the present invention, as shown in figure 3, described referring to Fig. 3 The iNode nodes stored in iNode areas include iNode nodes information fields, N-ary tree levels digital section, N-ary root vertexes Field and snapshot version pointer field;Wherein, the iNode nodes information fields are used for the management information of storage file, such as Founder, creation time, storing directory, authority etc.;The N-ary trees level digital section uses N-ary for storage file The series of tree construction;The N-ary root vertexes field is used for the start physical address of N grades of node pages of storage file;It is described Snapshot version pointer field is used to point to the snapshot iNode nodes corresponding to the last snapshot of the iNode nodes.
Step S102:The data field of N-ary tree constructions is set up based on root node page;Wherein, the N-ary trees include Any number of levels, last layer level node is stored with the physical address of corresponding next hierarchy node;Last hierarchy node It is data page, other nodes in addition to last described node layer are node page, the data page and node page In the data field mixing.
N-ary trees, are called N-ary tree, are a kind of tree data structures, for completing quicksort, the data compression of data And quick-searching.Data field in the embodiment of the present invention includes data page and node page, and the data page is used for storage file number According to the node page is used to store the physical address of next stage node page or data page in N-ary trees;The data page and described Node page is in data field mixing.Using the N grades of nodes page page number corresponding to file as root node, with (N-1) level node page page Number for the 1st grade of child node, by that analogy, using the 1st grade of node page page number as (N-1) level child node, one N-ary tree of formation with All data to this document carry out storage management;Wherein the 1st grade node page is data page;N-ary traversal of trees order is number According to the logical order of page;Moreover, in embodiments of the present invention, N-ary trees have a root node, the son node number of each node Can be with incomplete same.
It is a kind of structural representation of N-ary trees provided in an embodiment of the present invention, as shown in figure 4, with file referring to Fig. 4 Corresponding N grades of nodes page NodePageNPage number is root node, with (N-1) level node page NodePageN-1Page number is the 1st Level child node, by that analogy, with the 1st grade of node page NodePage1Page number is (N-1) level child node, forms a N-ary tree So that all data of this document are carried out with storage management, the 1st grade of node page is data page.
Specifically, the amount of physical memory where file data, based on N grades of node pages of file corresponding to file NodePageNPage number, (N-1) level node page NodePageN-1Page number ... ..., the 1st grade of node page NodePage1Page number, with N grades of node page NodePageNPage number is root node, with (N-1) level node page NodePageN-1Page number is the 1st grade of child node, By that analogy, the 1st grade of node page NodePage1Page number is (N-1) level child node, forms a N-ary tree and comes to number of files According to progress storage management.Its child node, the number of every grade of child node are managed in page table mode per first nodes in N-ary trees It is fixed as 512.As shown in figure 4, the 1st grade of node page NodePage1Page is data page.That is, from root node to N-2 Level child node is used for organizing node page, and N-1 grades of child nodes are used for organizing data page.Root node stores the 1st grade of son The physical address of the corresponding node page of node;1st grade of child node stores the physical address of the corresponding node page of the 2nd grade of child node; By that analogy, the physical address of the corresponding node page of (N-2) level child node storage (N-1) level child node.1st grade of node page For data page, all data pages occupy the afterbody node of N-ary trees.Therefore, the page physical address stored in node page can Think next stage node page physical address, or data page physical address.
In the present invention, all file datas are managed in the way of page, the size and operating system memory page of page are big It is small consistent.N-ary traversal of trees order is the logical order of data page.
Wherein, the logical page number (LPN) of the serial number data page of data page when N-ary trees travel through hereof.Therefore, may be used The logical page number (LPN) of data page where extrapolating the address with the logical address in file and the data page are to root node Path.
Step S103:The chained list directorial area being made up of page index record is set;Wherein, every page index record is right in order A physical page of data field is answered, page index record number is identical with data field number of physical pages;Page corresponding to each data page Index record stores the creation time of the data page and the positional information of last revision data page, so as to form page index chain The collection for whole old versions that the current version and snapshot of a data page are produced in table, every page index chained list respective file Close.
The chained list directorial area is made up of a plurality of page index record, every page index record in order corresponding data area one Individual physical page, page index record number is identical with data field physical page number, the page rope in data field corresponding to each data page Draw the interior creation time for preserving the data page of record and the thereon positional information of an edition data page, so as to be formed in data field Data page chained list, per data in page chained list in all data page respective files some logical data page current version and snapshot Whole old versions of generation.The chained list directorial area that the present invention is implemented is used for the snapshot version for managing logical data page in file, Realize data snapshot and the rollback of file system.
In one exemplary embodiment, chained list directorial area is made up of N bars page index record, every page index record correspondence number According to a physical page in area, chained list directorial area capacity is the 1/512 of data field total capacity, and page index record is using 8 bytes to be single Position, the mapping relations set up between page index record and data field Physical Page.Preceding 4 words of the page index record of chained list directorial area Memory page physical address is saved, rear 4 bytes store Physical Page modification time.Each logical page (LPAGE) of file system and one or more There is incidence relation in page index record, the modification time of page index record refers to the current modification time of logical page (LPAGE), page index note The page physical address of record refers to the physical address of corresponding data page after once being changed before logical page (LPAGE).Logical page (LPAGE) in file system When repeatedly being changed, the data page that same logical page (LPAGE) will have multiple versions, the data page of multiple versions is stored in data field, And the data page of each version corresponds to account for a memory-aided physical page respectively.There is incidence relation with same logical page (LPAGE) Page index record forms one page index chained list according to the time modification sequencing of the logical page (LPAGE), owns per data in page chained list Whole old versions that the current version of some logical data page and snapshot are produced in data page respective file.
It can be seen by the description of above-described embodiment, a kind of control method of file system provided in an embodiment of the present invention, led to The iNode areas for being provided for storing iNode nodes are crossed, the iNode nodes include N-ary tree levels digital section, N-ary tree root sections Point field and snapshot version pointer field;Wherein, the N-ary trees level digital section uses N-ary trees for storage file The series of structure, the N-ary root vertexes field is used for the physical address of storage file root node page, and the snapshot version refers to Pin field is used to point to the snapshot iNode nodes corresponding to the last snapshot of the iNode nodes;With root node page for base Plinth sets up the data field of N-ary tree constructions;Wherein, the N-ary trees include any number of levels, and last layer level node is stored with The physical address of corresponding next hierarchy node;Last hierarchy node is data page, except last described node layer it Other outer nodes are node page, and the data page and node page are in the data field mixing;Set to be indexed by page and remember Record the chained list directorial area of composition;Wherein, a physical page in every page index record corresponding data area in order, page index note Record number identical with data field number of physical pages;Page index record corresponding to each data page stores the creation time of the data page And the positional information of last revision data page, so that page index chained list is formed, one in every page index chained list respective file The set for whole old versions that the current version and snapshot of data page are produced.The present invention is established based on data link table and N- Ary tree constructions realize the file system of the random access of quick rollback, are stored in using N-ary tree constructions management file system The data of physical address space, realize random storage of the file data in amount of physical memory, without suitable by Documents Logical Sequence is in physical address space sequential storage, moreover, the snapshot version of logical data page in file is managed based on chained list, can be efficient Data snapshot and the rollback of file system are realized, so as to improve the operational efficiency of file system.
In order to be updated to iNode nodal informations in the file system in the embodiment of the present invention, an example of the invention Property embodiment also achieves the renewal of iNode nodal informations.It is a kind of iNode nodes provided in an embodiment of the present invention referring to Fig. 5 The schematic flow sheet of information updating method, as shown in figure 5, the embodiment of the present invention shows the process for updating iNode nodal informations:
Step S201:Creation time and the system snapshot time of target iNode nodes to be updated are obtained, wherein, it is described The system snapshot time is the time of the last snapshot of file system.
In a case study on implementation of the invention, when system request updates the filename of a file A, then need to file A correspondences Nodal information in target iNode nodes is updated.First, processor can be obtained by reading iNode nodes information fields Take the creation time T of target iNode nodesA;Meanwhile, can each snapshot of keeping records when file system creates snapshot every time Time, processor can obtain the last Snapshot time of file system, i.e. system snapshot time Tsnapshot
Step S202:If the creation time of the target iNode nodes is later than the system snapshot time, update described INode nodes information fields in target iNode nodes.
Further, processor compares creation time TAWith system snapshot time Tsnapshot.If TAIt is later than Tsnapshot,, then say Prescribed paper A iNodeANode creation time is later than the last snapshot creation time, and Snapshot time has not arrived next time, Directly the iNode nodes information fields in target iNode nodes can repeatedly be changed, so as to realize that file A is corresponding iNodeAThe renewal of nodal information.
Step S203:If the creation time of the target iNode nodes is earlier than the system snapshot time, described INode areas distribution free time iNode nodes are used as snapshot iNode nodes;The snapshot according to the target iNode node initializings INode nodes;The snapshot iNode node numbers are preserved in the target iNode nodes, are saved with pointing to the snapshot iNode Point, and more fresh target iNode nodes iNode nodes information fields.
If TAEarlier than Tsnapshot,, then supporting paper A iNodeAWhen node creation time is created earlier than the last snapshot Between, it is saved when the last snapshot is created to cross iNodeAThe status information of node, updates iNode againANodal information When, then need newly to distribute a free time iNode in iNode areasA1Node is used as node i NodeASnapshot iNodeA1, it is based on iNodeANodal information initial snapshot iNodeA1Nodal information, and in iNodeASnapshot iNode is preserved on nodeA1Node number, It is then based on node i NodeA, renewal is completed by changing iNode nodes information fields.Moreover, in the specific implementation, Ke Yigeng New iNodeAIn snapshot version pointer field so that snapshot version pointer field points to snapshot iNodeA1
, would generally be right when being operated to file system because data page carries the middle number of files of file system it is believed that ceasing Data page is updated, and the embodiment of the present invention additionally provides a kind of update method of the data page of file system.Referring to Fig. 6, it is The schematic flow sheet of a kind of data page update method provided in an embodiment of the present invention, as shown in fig. 6, the embodiment of the present invention is shown Update the data the process of page:
Step S301:Creation time and the system snapshot time of target data page to be updated are obtained, wherein, the system Snapshot time is the time of the last snapshot of file system.
In a case study on implementation of the invention, write operation is carried out to file A.It is provided in an embodiment of the present invention one referring to Fig. 7 The schematic diagram of data area structure is planted, if file A presses write operation order, to the 1st logical page (LPAGE), the 500th logical page (LPAGE), the 600th Individual logical page (LPAGE), the 1000th logical page (LPAGE) realize write operation, then the N-ary tree constructions and file data of this document are in data The distribution situation in area is as shown in Figure 7.This document has 3 node pages, 4 data pages, its interior joint page NodePage3For root section Point stores node page NodePage21 and NodePage22 physical address, node page NodePage21 store with accordingly The corresponding data page DataPage of logical page number (LPN)21 and data page DataPage5001 physical address, node page NodePage22 Store data page DataPage corresponding with respective logic page number6001 and data page DataPage10001 physical address. Accordingly, 4 index records correspond to data page DataPage respectively in chained list directorial area21、DataPage5001、 DataPage6001 and data page DataPage10001, it have recorded the creation time of corresponding data page.
The renewal of data page exemplified by carrying out data renewal to the 500th logical page (LPAGE), will be described in detail in the embodiment of the present invention Process.When to the 500th logical page (LPAGE) update for the first time, NodePage21 is stored with data page DataPage5001 thing Address is managed, then the target data page can be understood as DataPage5001, processor first by search in chained list directorial area with DataPage5001 corresponding index record, so as to obtain DataPage5001 creation time;Meanwhile, such as retouching for above-mentioned example State, processor can also obtain the system snapshot time T of file systemsnapshot,
Step S302:If the creation time of the target data page is later than the system snapshot time, it will update the data Write the target data page.
Data page DataPage corresponding to 500th logical page (LPAGE)5001 creation time TDataPage5001 and and and file The last Snapshot time T of systemsnapshot, compare, if TDataPage5001 is later than Tsnapshot, then illustrate the 500th and patrol Data page DataPage5001 creation times corresponding to volume page are later than the last snapshot creation time, and next time snapshot when Between have not arrived, can will directly update the data and be written in data page DataPage5001, repeatedly to update the node thereon Relevant information.
Step S303:If the creation time of the target data page will be updated the data earlier than the system snapshot time The free page of data field is write, new data page is formed;In chained list directorial area, the page index record of the new data page is set, and will The positional information and current time of target data page are write in the page index record of the new data page so that the new data page Page index record be inserted into the head of data page chained list;The physical address of new data page is updated corresponding to target data page On node page, the node page is set to point to new data page.
If TDataPage5001 earlier than Tsnapshot,, then data page DataPage is illustrated5001 creation time is earlier than the last time Snapshot creation time, it is saved when the last snapshot is created to cross DataPage5001 status information, process is right again When 500th logical page data updates, a data corresponding with the 500th logical page (LPAGE) are newly distributed based on page faults mechanism Page DataPage5002, create one and data page DataPage in chained list area5002 corresponding index records, then by data Page DataPage500Node page NodePage is arrived in 2 physical address storage21 appropriate address field.In chained list directorial area, with number According to page DataPage5002 distribution time filling is with physics by data page DataPage500The 2 corresponding index record of Physical Page Time field, with data page DataPage5001 physical address is updated data page DataPage with physics5002 Physical Page The physical address field of corresponding index record.
By that analogy, accordingly specified after repeatedly being updated to the 500th logical page (LPAGE) and repeatedly after time interval snapshot, after It is continuous to be assigned with Physical Page DataPage5003、DataPage5004th ..., DataPage500The 500th logical data page of N, file A Current version and snapshot produce whole old versions it is as shown in Figure 7.
In one example embodiment of the present invention, the file system can include root folder, and described text File content under snapshot document folder under part folder, the root folder in addition to snapshot document is pressed from both sides is mapped to the snapshot document Under folder;Specifically, file system safeguards a snapshot document folder snapshot under root folder/root, passes through the side of mapping Method passes through the current version of root folder path access file data by under the content map of root file system to snapshot document folder This, presss from both sides path to realize the File Snapshot version corresponding to the specified time by snapshot document.The embodiment of the present invention is with POSIX (English:Portable Operating System Interface of UNIX, Chinese:Portable operating system interface) side Formula accesses file data, and snapshot document or ordinary file are distinguished by iNode identification means, with realize to snapshot document with Read access, the read and write access to ordinary file.It is a kind of file access control method provided in an embodiment of the present invention referring to Fig. 8 Schematic flow sheet, as shown in figure 8, the embodiment of the present invention show to root folder and snapshot document folder under file access control The process of system:
Step S401:When by root folder path access file, the file of current version is read or write.
Referring to Fig. 9, it is the principle schematic that a kind of file provided in an embodiment of the present invention and snapshot document are accessed, such as schemes Shown in 9, in embodiments of the present invention, root/root of file system presss from both sides snapshot/ and three comprising a snapshot document File File1, File2, File3.When system will access the data in file system, internal memory is arrived by file system mounted first In, create a root node is Noderoot, iNode is filled based on the root nodal informations in file systemrootNodal information, When system will be accessed to iNodeFile1During the file answered, system is by the file data of file File1 current versions from file system System reads in internal memory, then carries out corresponding read-write operation.
Step S402:When pressing from both sides path access file by snapshot document, the iNode nodes of the file are marked;If Operation to file is write-in, returns to refuse information according to the iNode nodes after mark, is write with refusing absolute file;Such as Fruit, to read, according to the iNode nodes and specified Snapshot time after mark, reads the specified Snapshot time to the operation of file The file of latest edition before.
When system will access the file under snapshot snapshot files, it is necessary to by the content map of root folder to fast INode is filled according to the root nodal informations under file, being primarily based in file systemsnapshotNodal information, when system will be visited Ask iNode under snapshot filesFile1During corresponding file, iNode will be marked firstFile1, for example, predetermined mark is set Know or in iNodeFile1Corresponding iNode areas storage;Then system is by the iNode after markFile1And it is corresponding specified Snapshot time is handed down to file system.File system is according to labeled iNodeFile1, search iNodeFile1Corresponding file, And specify time corresponding snapshot version copy into internal memory for system read access access request.
The snapshot document of user's access old version is there is provided the flexibility of file system for convenience, referring to Figure 10, is this A kind of schematic flow sheet for snapshot document access method that inventive embodiments are provided, file system is in response read operation file system When being accessed in POSIX modes, specified time T can be accessed0State data memory, as shown in Figure 10, the embodiment of the present invention is shown The process for accessing snapshot version file is gone out:
Step S501:From chained list directorial area, search the page corresponding with target data page and index chained list.
In one exemplary embodiment, with process requested access T0Exemplified by logical page (LPAGE) LPage before moment, due to logic Page LPage may undergo multiple snapshot or renewal, in chained list directorial area, the corresponding page index chain tokens of logical page (LPAGE) LPage Logical page (LPAGE) LPage snapshots and all versions updated are recorded, the target data page can be understood as current logical page LPage institutes The data page of corresponding latest edition.All pages of index chained lists in processor traversal chained list directorial area, so as to find out and patrol Collect page LPage and the corresponding page index chained list of target data page.
Step S502:From find out the page index chained list in, selection earlier than and with the specified time it is immediate Page index record.
Step S503:The positional information in the page index record is extracted, and according to the positional information, updates the mesh The physical address in node page corresponding to data page is marked, so that node page points to the snapshot version number corresponding to the time of specifying According to page.
By updating the physical address in the node page corresponding to target data page, when such node page can point at specified Between T0Corresponding snapshot data page, so as to realize access File Snapshot version.
The recovery of file system for convenience, is a kind of file rollback method provided in an embodiment of the present invention referring to Figure 11 Schematic flow sheet, as shown in figure 11, the embodiment of the present invention shows that file rolls back to the process of the FileVersion of Snapshot time:
Step S601:Close the file of all openings.
When receiving file rollback instruction, the file of all openings is closed in processor control.
Step S602:Obtain the creation time and erasing time of all iNode nodes in iNode areas;When iNode nodes When creation time is later than the Snapshot time, deletes and reclaim corresponding iNode nodes;When the erasing time of iNode nodes is later than During the Snapshot time, recover corresponding iNode nodes, and the linking relationship between iNode nodes.
By the iNode areas of traversal file system, the creation time of all iNode nodes and deletion in iNode areas are obtained Time, wherein, the creation time can be understood as creating the time of iNode nodes, such as a newly-built file is so as to create The time of one iNode node, the erasing time can be understood as deleting the time of iNode nodes, for example, delete a text Part is so as to delete the time of an iNode node.
When the creation time of iNode nodes is later than the Snapshot time, represent before Snapshot time, iNode sections Point there is not yet, then delete and reclaim corresponding iNode nodes.When the erasing time of iNode nodes is later than the Snapshot time, Represent before Snapshot time, the iNode nodes were once present, simply deleted after Snapshot time, then recover phase The iNode nodes answered;Simultaneously as iNode nodes potentially include multiple snapshot iNode nodes, and snapshot iNode nodes it Between corresponding chained list relation is established by snapshot version pointer field, therefore, in embodiments of the present invention, can also be right The linking relationship of iNode nodes is recovered, by changing being directed to the iNode of deletion section of snapshot version pointer field Point is returned in chained list;Other iNode nodes retain constant.
Step S603:Obtain the creation time of the data page that all pages of index records are preserved in chained list directorial area;Work as data When the creation time of page is later than the Snapshot time, corresponding data page is reclaimed, and delete the page rope corresponding to data page Draw the page index record in chained list;It will be updated earlier than Snapshot time and with the address in the immediate page index record of Snapshot time To the node page of the data page, recover file to the FileVersion of Snapshot time.
The same data page in data field carries out the number preserved in rollback, traversal all pages of index records of chained list directorial area According to the creation time of page;When the creation time of data page is later than Snapshot time, entered by changing the corresponding bit in bit map area Row is reclaimed, and deletes the page index record in the page index chained list corresponding to data page, is accordingly repaiied with being made to linking relationship Change;Further, it will be updated earlier than Snapshot time and with the address in the immediate page index record of Snapshot time to the data The node page of page, recovers file to the FileVersion of Snapshot time;Also, other data pages retain constant.
Control method embodiment with the file system of the present invention is corresponding, and the embodiment of the present invention additionally provides a kind of file The control device of system.
It is a kind of structural representation of the control device of file system provided in an embodiment of the present invention referring to Figure 12, such as schemes Shown in 12, the control device of this document system includes:
INode areas setup module 11, the iNode areas for being provided for storing iNode nodes, the iNode nodes bag Include N-ary tree levels digital section, N-ary root vertexes field and snapshot version pointer field;Wherein, the N-ary trees series Field is used for the series that storage file uses N-ary tree constructions, and the N-ary root vertexes field is used for storage file root section The physical address of point page, the snapshot version pointer field is used to point to corresponding to the last snapshot of the iNode nodes Snapshot iNode nodes;
Data field setup module 12, the data field for setting up N-ary tree constructions based on root node page;Wherein, institute N-ary trees are stated including any number of levels, last layer level node is stored with the physical address of corresponding next hierarchy node;Most Latter hierarchy node is data page, and other nodes in addition to last described node layer are node page, the data page With node page in the data field mixing.
Chained list directorial area setup module 13, for setting the chained list directorial area being made up of page index record;Wherein, every page One physical page in index record corresponding data area in order, page index record number is identical with data field number of physical pages;Each Page index record corresponding to data page stores the creation time of the data page and the positional information of last revision data page, So as to form page index chained list, it is complete that the current version and snapshot that every page indexes a data page in chained list respective file are produced The set of portion's old version.
Under the first performance, the control device can also include iNode nodal informations update module 14, described INode nodes also include the iNode nodes information fields for storing its nodal information, and the iNode node updates module is used for,
Creation time and the system snapshot time of target iNode nodes to be updated are obtained, wherein, during the system snapshot Between for the last snapshot of file system time;
If the creation time of the target iNode nodes is later than the system snapshot time, the target iNode is updated INode nodes information fields in node;Or,
If the creation time of the target iNode nodes is earlier than the system snapshot time, in iNode areas distribution Idle iNode nodes update the snapshot version pointer field as snapshot iNode nodes;Saved according to the target iNode The point initialization snapshot iNode nodes;The snapshot iNode node numbers are preserved in the target iNode nodes, to point to The snapshot iNode nodes, and more fresh target iNode nodes iNode nodes information fields.
Under second of performance, the control device can also include data page update module 15, be used for,
Creation time and the system snapshot time of target data page to be updated are obtained, wherein, the system snapshot time For the time of the last snapshot of file system;
If the creation time of the target data page is later than the system snapshot time, the write-in mesh will be updated the data Mark data page;Or,
If the creation time of the target data page will update the data write-in data field earlier than the system snapshot time Free page, formed new data page;In chained list directorial area, the page index record of new data page is set, and by target data page Positional information and current time write in the page index record of new data page so that the page index note of the new data page Record is inserted into the head of data page chained list;The physical address of new data page is updated onto the corresponding node page of target data page, The node page is set to point to new data page.
Under the third performance, the control device also includes operational control module 16, wherein, the file system Pressed from both sides including the snapshot document under root folder, and the root folder, under the root folder in addition to snapshot document is pressed from both sides File content is mapped under the snapshot document folder, and the operational control module is used for,
When by root folder path access file, the file of current version is read or write;Or,
When pressing from both sides path access file by snapshot document, the iNode nodes of the file are marked;If to the behaviour of file As write-in, refuse information is returned to according to the iNode nodes after mark, write with refusing absolute file;If to file Operate to read, according to the iNode nodes and specified Snapshot time after mark, read latest edition before the specified Snapshot time This file.
Under the 4th kind of performance, the control device also includes access control module 17, is used for,
From chained list directorial area, search the page corresponding with target data page and index chained list;
From the page index chained list found out, selection is remembered earlier than and with the specified time immediate page index Record;
The positional information in the page index record is extracted, and according to the positional information, updates the target data page Physical address in corresponding node page, so that node page points to the snapshot edition data page corresponding to the time of specifying.
Under the 5th kind of performance, the control device can also include roll-back module 18, be used for,
Close the file of all openings;
Obtain the creation time and erasing time of all iNode nodes in iNode areas;When the creation time of iNode nodes When being later than the Snapshot time, delete and reclaim corresponding iNode nodes;When the erasing time of iNode nodes is later than the snapshot During the time, recover corresponding iNode nodes, and the linking relationship between iNode nodes;
Obtain the creation time of the data page that all pages of index records are preserved in chained list directorial area;When the establishment of data page Between when being later than the Snapshot time, reclaim corresponding data page, and delete in the page index chained list corresponding to data page Page index record;It will be updated earlier than Snapshot time and with the address in the immediate page index record of Snapshot time to the data The node page of page, recovers file to the FileVersion of Snapshot time.
The embodiment of the present invention also provides a kind of terminal, specifically, and the terminal can be understood as personal computer, PAD etc. Portable terminal device and server etc..In embodiments of the present invention, the terminal includes at least one processor;And,
The memory being connected with least one described processor communication;Wherein,
The memory storage has can be by the instruction of one computing device, and the instruction is by described at least one Manage device to perform, so that at least one described processor can:
It is provided for storing the iNode areas of iNode nodes, the iNode nodes include N-ary tree levels digital section, N-ary Root vertex field and snapshot version pointer field;Wherein, the N-ary trees level digital section uses N- for storage file The series of ary tree constructions, the N-ary root vertexes field is used for the physical address of storage file root node page, the snapshot Version pointer field is used to point to the snapshot iNode nodes corresponding to the last snapshot of the iNode nodes;
The data field of N-ary tree constructions is set up based on root node page;Wherein, the N-ary trees include any number of Level, last layer level node stores the physical address of corresponding next hierarchy node;Last hierarchy node is data page, Other nodes in addition to last described node layer are node page, and the data page and node page are in the data field Mixing;
The chained list directorial area being made up of page index record is set;Wherein, every page index record corresponding data area in order A physical page, page index record number is identical with data field number of physical pages;Page index record corresponding to each data page The creation time of the data page and the positional information of last revision data page are stored, so as to form page index chained list, every The set for whole old versions that the current version and snapshot of a data page are produced in page index chained list respective file.
Moreover, the processor in the terminal can be additionally configured to perform the control method embodiment of above-mentioned file system Described method and step.
In summary, control method, device and the terminal for a kind of file system that the present invention is provided, is tied using N-ary trees Structure management file system is stored in the data of physical address space, realizes file data depositing at random in amount of physical memory Storage, the snapshot version of logical data page in file is managed based on chained list, data snapshot and the rollback of file system is realized, the present invention Effectively overcome various shortcoming of the prior art and have high industrial utilization.
The above-described embodiments merely illustrate the principles and effects of the present invention, not for the limitation present invention.It is any ripe Know the personage of this technology all can carry out modifications and changes under the spirit and scope without prejudice to the present invention to above-described embodiment.Cause This, those of ordinary skill in the art is complete without departing from disclosed spirit and institute under technological thought such as Into all equivalent modifications or change, should by the present invention claim be covered.

Claims (13)

1. a kind of control method of file system, it is characterised in that the control method comprises the following steps:
It is provided for storing the iNode areas of iNode nodes, the iNode nodes include N-ary tree levels digital section, N-ary tree roots Node field and snapshot version pointer field;Wherein, the N-ary trees level digital section uses N-ary for storage file The series of tree construction, the N-ary root vertexes field is used for the physical address of storage file root node page, the snapshot version Pointer field is used to point to the snapshot iNode nodes corresponding to the last snapshot of the iNode nodes;
The data field of N-ary tree constructions is set up based on root node page;Wherein, the N-ary trees include any number of levels, Last layer level node is stored with the physical address of corresponding next hierarchy node;Last hierarchy node is data page, is removed Other nodes outside last described node layer are node page, and the data page and node page are mixed in the data field Row;
The chained list directorial area being made up of page index record is set;Wherein, every page index record in order corresponding data area one Individual physical page, page index record number is identical with data field number of physical pages;Page index record storage corresponding to each data page The creation time of the data page and the positional information of last revision data page, so as to form page index chained list, every page rope Draw in chained list respective file the set for whole old versions that the current version and snapshot of a data page are produced, for realizing text The snapshot rollback of part.
2. the control method of file system according to claim 1, it is characterised in that the iNode nodes also include depositing Store up the iNode nodes information fields of its nodal information, the step of control method also includes updating iNode nodal informations:
Creation time and the system snapshot time of target iNode nodes to be updated are obtained, wherein, the system snapshot time is The time of file system the last time snapshot;
If the creation time of the target iNode nodes is later than the system snapshot time, the target iNode nodes are updated In iNode nodes information fields;Or,
If the creation time of the target iNode nodes distributes idle earlier than the system snapshot time in the iNode areas INode nodes are used as snapshot iNode nodes;The snapshot iNode nodes according to the target iNode node initializings;Institute State and the snapshot iNode node numbers are preserved in target iNode nodes, to point to the snapshot iNode nodes, and more fresh target The iNode nodes information fields of iNode nodes.
3. the control method of file system according to claim 1, it is characterised in that the control method also includes updating The step of data page:
Creation time and the system snapshot time of target data page to be updated are obtained, wherein, the system snapshot time is text The time of part system the last time snapshot;
If the creation time of the target data page is later than the system snapshot time, the write-in number of targets will be updated the data According to page;Or,
If the creation time of the target data page will update the data the sky of write-in data field earlier than the system snapshot time Not busy page, forms new data page;In chained list directorial area, the page index record of new data page is set, and by the position of target data page Confidence is ceased and current time is write in the page index record of the new data page so that the page index record of the new data page is inserted Enter to the head of data page chained list;The physical address of new data page is updated onto the corresponding node page of target data page, makes institute State node page and point to new data page.
4. the control method of file system according to claim 1, it is characterised in that the file system includes root file File content under folder, and the snapshot document folder under the root folder, the root folder in addition to snapshot document is pressed from both sides reflects It is mapped under the snapshot document folder, the control method also includes:
When by root folder path access file, the file of current version is read or write;Or,
When pressing from both sides path access file by snapshot document, the iNode nodes of the file are marked;If the operation to file is Write-in, returns to refuse information according to the iNode nodes after mark, is write with refusing absolute file;If the operation to file To read, according to the iNode nodes and specified Snapshot time after mark, latest edition before the specified Snapshot time is read File.
5. the control method of file system according to claim 1, it is characterised in that when the number of targets for accessing the time of specifying During according to page, the control method also includes:
From chained list directorial area, search the page corresponding with target data page and index chained list;
From the page index chained list found out, select earlier than and with the specified time immediate page index record;
The positional information in the page index record is extracted, and according to the positional information, updates the target data page institute right The physical address in node page is answered, so that node page points to the snapshot edition data page corresponding to the time of specifying.
6. the control method of file system according to claim 1, it is characterised in that when file is rolled back into Snapshot time FileVersion when, the control method also includes:
Close the file of all openings;
Obtain the creation time and erasing time of all iNode nodes in iNode areas;When the creation time of iNode nodes is later than During the Snapshot time, delete and reclaim corresponding iNode nodes;When the erasing time of iNode nodes is later than the Snapshot time When, recover corresponding iNode nodes, and the linking relationship between iNode nodes;
Obtain the creation time of the data page that all pages of index records are preserved in chained list directorial area;When the creation time evening of data page When the Snapshot time, corresponding data page is reclaimed, and delete the page rope in the page index chained list corresponding to data page Draw record;It will be updated earlier than Snapshot time and with the address in the immediate page index record of Snapshot time to the data page Node page, recovers file to the FileVersion of Snapshot time.
7. a kind of control device of file system, it is characterised in that the control device includes:
INode areas setup module, the iNode areas for being provided for storing iNode nodes, the iNode nodes include N-ary Set level digital section, N-ary root vertexes field and snapshot version pointer field;Wherein, the N-ary trees level digital section is used for Storage file uses the series of N-ary tree constructions, and the N-ary root vertexes field is used for the thing of storage file root node page Address is managed, the snapshot version pointer field is used to point to the snapshot corresponding to the last snapshot of the iNode nodes INode nodes;
Data field setup module, the data field for setting up N-ary tree constructions based on root node page;Wherein, the N-ary Tree includes any number of levels, and last layer grade node is stored with the physical address of corresponding next hierarchy node;Last layer Level node is data page, and other nodes in addition to last described node layer are node page, the data page and described Node page is in the data field mixing;
Chained list directorial area setup module, for setting the chained list directorial area being made up of page index record;Wherein, every page index note A physical page in corresponding data area in order is recorded, page index record number is identical with data field number of physical pages;Each data page Corresponding page index record stores the creation time of the data page and the positional information of last revision data page, so that shape Whole history that the current version and snapshot for indexing a data page in chained list, every page index chained list respective file into page are produced The set of version, the snapshot rollback for realizing file.
8. the control device of file system according to claim 7, it is characterised in that the control device also includes INode nodal information update modules, the iNode nodes also include the iNode nodes information fields for storing its nodal information, institute INode node updates modules are stated, are used for,
Creation time and the system snapshot time of target iNode nodes to be updated are obtained, wherein, the system snapshot time is The time of file system the last time snapshot;
If the creation time of the target iNode nodes is later than the system snapshot time, the target iNode nodes are updated In iNode nodes information fields;Or,
If the creation time of the target iNode nodes distributes idle earlier than the system snapshot time in the iNode areas INode nodes update the snapshot version pointer field as snapshot iNode nodes;According at the beginning of the target iNode nodes The beginningization snapshot iNode nodes;The snapshot iNode node numbers are preserved in the target iNode nodes, it is described to point to Snapshot iNode nodes, and more fresh target iNode nodes iNode nodes information fields.
9. the control device of file system according to claim 7, it is characterised in that the control device also includes data Web update module, is used for,
Creation time and the system snapshot time of target data page to be updated are obtained, wherein, the system snapshot time is text The time of part system the last time snapshot;
If the creation time of the target data page is later than the system snapshot time, the write-in number of targets will be updated the data According to page;Or,
If the creation time of the target data page will update the data the sky of write-in data field earlier than the system snapshot time Not busy page, forms new data page;In chained list directorial area, the page index record of new data page is set, and by the position of target data page Confidence is ceased and current time is write in the page index record of the new data page so that the page index record of the new data page is inserted Enter to the head of data page chained list;The physical address of new data page is updated onto the corresponding node page of target data page, makes institute State node page and point to new data page.
10. the control device of file system according to claim 7, it is characterised in that the control device also includes behaviour Make control module, wherein, the file system includes the snapshot document folder under root folder, and the root folder, described File content under root folder in addition to snapshot document is pressed from both sides is mapped under the snapshot document folder, and the operational control module is used In,
When by root folder path access file, the file of current version is read or write;Or,
When pressing from both sides path access file by snapshot document, the iNode nodes of the file are marked;If the operation to file is Write-in, returns to refuse information according to the iNode nodes after mark, is write with refusing absolute file;If the operation to file To read, according to the iNode nodes and specified Snapshot time after mark, latest edition before the specified Snapshot time is read File.
11. the control device of file system according to claim 7, it is characterised in that the control device also includes visiting Control module is asked, is used for,
From chained list directorial area, search the page corresponding with target data page and index chained list;
From the page index chained list found out, select earlier than and with the specified time immediate page index record;
The positional information in the page index record is extracted, and according to the positional information, updates the target data page institute right The physical address in node page is answered, so that node page points to the snapshot edition data page corresponding to the time of specifying.
12. the control device of file system according to claim 7, it is characterised in that the control device also includes back Module is rolled, is used for,
Close the file of all openings;
Obtain the creation time and erasing time of all iNode nodes in iNode areas;When the creation time of iNode nodes is later than During the Snapshot time, delete and reclaim corresponding iNode nodes;When the erasing time of iNode nodes is later than the Snapshot time When, recover corresponding iNode nodes, and the linking relationship between iNode nodes;
Obtain the creation time of the data page that all pages of index records are preserved in chained list directorial area;When the creation time evening of data page When the Snapshot time, corresponding data page is reclaimed, and delete the page rope in the page index chained list corresponding to data page Draw record;It will be updated earlier than Snapshot time and with the address in the immediate page index record of Snapshot time to the data page Node page, recovers file to the FileVersion of Snapshot time.
13. a kind of terminal, it is characterised in that the terminal includes at least one processor;And,
The memory being connected with least one described processor communication;Wherein,
The memory storage has can be by the instruction of one computing device, and the instruction is by least one described processor Perform, so that at least one described processor can:
It is provided for storing the iNode areas of iNode nodes, the iNode nodes include N-ary tree levels digital section, N-ary tree roots Node field and snapshot version pointer field;Wherein, the N-ary trees level digital section uses N-ary for storage file The series of tree construction, the N-ary root vertexes field is used for the physical address of storage file root node page, the snapshot version Pointer field is used to point to the snapshot iNode nodes corresponding to the last snapshot of the iNode nodes;
The data field of N-ary tree constructions is set up based on root node page;Wherein, the N-ary trees include any number of levels, Last layer level node stores the physical address of corresponding next hierarchy node;Last hierarchy node is data page, except institute It is node page to state other nodes outside last node layer, and the data page and node page are mixed in the data field Row;
The chained list directorial area being made up of page index record is set;Wherein, every page index record in order corresponding data area one Individual physical page, page index record number is identical with data field number of physical pages;Page index record storage corresponding to each data page The creation time of the data page and the positional information of last revision data page, so as to form page index chained list, every page rope Draw in chained list respective file the set for whole old versions that the current version and snapshot of a data page are produced, for realizing text The snapshot rollback of part.
CN201710337922.5A 2017-05-15 2017-05-15 File system control method and device and terminal Active CN107180092B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710337922.5A CN107180092B (en) 2017-05-15 2017-05-15 File system control method and device and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710337922.5A CN107180092B (en) 2017-05-15 2017-05-15 File system control method and device and terminal

Publications (2)

Publication Number Publication Date
CN107180092A true CN107180092A (en) 2017-09-19
CN107180092B CN107180092B (en) 2020-10-23

Family

ID=59831495

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710337922.5A Active CN107180092B (en) 2017-05-15 2017-05-15 File system control method and device and terminal

Country Status (1)

Country Link
CN (1) CN107180092B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704599A (en) * 2017-10-16 2018-02-16 杭州安恒信息技术有限公司 A kind of method and apparatus for realizing EDR data quick-searchings
CN108062233A (en) * 2017-12-29 2018-05-22 上海大汉三通无线通信有限公司 A kind of file backing method, system, device and computer readable storage medium
CN108563751A (en) * 2018-04-16 2018-09-21 中国刑事警察学院 Database fragment extracting method
CN109445989A (en) * 2018-10-22 2019-03-08 郑州云海信息技术有限公司 A kind of file system data backup method and device
CN109710542A (en) * 2018-12-28 2019-05-03 北京像素软件科技股份有限公司 A kind of completely N-ary tree construction method and device
CN109933564A (en) * 2019-03-27 2019-06-25 中国科学院上海微系统与信息技术研究所 File system management method, device, terminal, the medium of quick rollback are realized based on chained list and N-ary tree construction
CN110019016A (en) * 2017-12-29 2019-07-16 北京忆恒创源科技有限公司 The KV for providing logic key stores device and method thereof
CN110018989A (en) * 2017-11-13 2019-07-16 华为技术有限公司 A kind of method and apparatus that snapshot compares
CN111090835A (en) * 2019-12-06 2020-05-01 支付宝(杭州)信息技术有限公司 Method and device for constructing file derivative graph
CN111400101A (en) * 2020-03-18 2020-07-10 北京北亚宸星科技有限公司 Data recovery method and system for deleting JFS2 file system data
CN111797058A (en) * 2020-07-02 2020-10-20 长沙景嘉微电子股份有限公司 Universal file system and file management method
CN115185891A (en) * 2022-09-14 2022-10-14 联想凌拓科技有限公司 Data management method and device of file system, electronic equipment and storage medium
CN113986824B (en) * 2021-10-27 2024-02-23 西安热工研究院有限公司 Method for efficiently storing and retrieving time sequence data

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101178677A (en) * 2007-11-09 2008-05-14 中国科学院计算技术研究所 Computer system for protecting software and method for protecting software
US8463820B2 (en) * 2009-05-26 2013-06-11 Intel Corporation System and method for memory bandwidth friendly sorting on multi-core architectures
CN103577329A (en) * 2013-10-18 2014-02-12 华为技术有限公司 Snapshot management method and device
US9244928B1 (en) * 2013-03-05 2016-01-26 Ca, Inc. Systems and methods for directory snapshot
CN106354890A (en) * 2016-11-22 2017-01-25 中国科学院上海微系统与信息技术研究所 Implementation method of random access file system based on N-ary tree structure

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101178677A (en) * 2007-11-09 2008-05-14 中国科学院计算技术研究所 Computer system for protecting software and method for protecting software
US8463820B2 (en) * 2009-05-26 2013-06-11 Intel Corporation System and method for memory bandwidth friendly sorting on multi-core architectures
US9244928B1 (en) * 2013-03-05 2016-01-26 Ca, Inc. Systems and methods for directory snapshot
CN103577329A (en) * 2013-10-18 2014-02-12 华为技术有限公司 Snapshot management method and device
CN106354890A (en) * 2016-11-22 2017-01-25 中国科学院上海微系统与信息技术研究所 Implementation method of random access file system based on N-ary tree structure

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704599A (en) * 2017-10-16 2018-02-16 杭州安恒信息技术有限公司 A kind of method and apparatus for realizing EDR data quick-searchings
CN110018989B (en) * 2017-11-13 2021-05-18 华为技术有限公司 Snapshot comparison method and device
CN110018989A (en) * 2017-11-13 2019-07-16 华为技术有限公司 A kind of method and apparatus that snapshot compares
CN108062233A (en) * 2017-12-29 2018-05-22 上海大汉三通无线通信有限公司 A kind of file backing method, system, device and computer readable storage medium
CN110019016A (en) * 2017-12-29 2019-07-16 北京忆恒创源科技有限公司 The KV for providing logic key stores device and method thereof
CN108563751A (en) * 2018-04-16 2018-09-21 中国刑事警察学院 Database fragment extracting method
CN109445989A (en) * 2018-10-22 2019-03-08 郑州云海信息技术有限公司 A kind of file system data backup method and device
CN109710542A (en) * 2018-12-28 2019-05-03 北京像素软件科技股份有限公司 A kind of completely N-ary tree construction method and device
CN109933564A (en) * 2019-03-27 2019-06-25 中国科学院上海微系统与信息技术研究所 File system management method, device, terminal, the medium of quick rollback are realized based on chained list and N-ary tree construction
CN111090835A (en) * 2019-12-06 2020-05-01 支付宝(杭州)信息技术有限公司 Method and device for constructing file derivative graph
CN111400101A (en) * 2020-03-18 2020-07-10 北京北亚宸星科技有限公司 Data recovery method and system for deleting JFS2 file system data
CN111400101B (en) * 2020-03-18 2021-06-01 北京北亚宸星科技有限公司 Data recovery method and system for deleting JFS2 file system data
CN111797058A (en) * 2020-07-02 2020-10-20 长沙景嘉微电子股份有限公司 Universal file system and file management method
CN111797058B (en) * 2020-07-02 2024-02-09 长沙景嘉微电子股份有限公司 Universal file system and file management method
CN113986824B (en) * 2021-10-27 2024-02-23 西安热工研究院有限公司 Method for efficiently storing and retrieving time sequence data
CN115185891A (en) * 2022-09-14 2022-10-14 联想凌拓科技有限公司 Data management method and device of file system, electronic equipment and storage medium
CN115185891B (en) * 2022-09-14 2023-01-17 联想凌拓科技有限公司 Data management method and device of file system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN107180092B (en) 2020-10-23

Similar Documents

Publication Publication Date Title
CN107180092A (en) A kind of control method of file system, device and terminal
CN101916299B (en) Three-dimensional spatial data storage and management method based on file system
CN101639848A (en) Spatial data engine and method applying management spatial data thereof
CN105760113B (en) High-speed processing apparatus and file management method based on nand flash memory
CN103559323B (en) Database implementation method
CN104217023B (en) It is a kind of to solve the method for map tile storage using packaging technique
CN104298681B (en) A kind of date storage method and device
CN103140840B (en) The method and device of data management
CN102982151B (en) Method for merging multiple physical files into one logic file
CN105868228A (en) In-memory database system providing lockless read and write operations for OLAP and OLTP transactions
CN110347336A (en) A kind of key assignments storage system based on NVM with SSD mixing storage organization
CN106682110B (en) Image file storage and management system and method based on Hash grid index
CN106502587A (en) Data in magnetic disk management method and magnetic disk control unit
CN105205126A (en) Storage method and storage system for map tiles
CN107463447A (en) B + tree management method based on remote direct nonvolatile memory access
CN101488153A (en) Method for implementing high-capacity flash memory file system in embedded type Linux
CN107784121A (en) Lowercase optimization method of log file system based on nonvolatile memory
CN106354890B (en) A kind of implementation method of the file system of the random access based on N-ary tree construction
CN101571869A (en) File memory and read method of smart card and device thereof
CN109558084A (en) A kind of data processing method and relevant device
CN109933564A (en) File system management method, device, terminal, the medium of quick rollback are realized based on chained list and N-ary tree construction
CN105930356A (en) Method for implementing log type heterogeneous hybrid memory file system
CN1845093A (en) Attribute extensible object file system
CN102253985B (en) File system data management method and system
CN108052541A (en) The realization of file system based on multi-level page-table bibliographic structure, access method, terminal

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
GR01 Patent grant
GR01 Patent grant