Background technology
Metadata is the data of data of description.In file system, volume management system and fast photographic system, often can use metadata, utilize metadata information to come the feature of data of description.
The form of management of metadata information is various, and metadata has different forms in the different systems.For example in fast photographic system, the quantity of information of metadata is larger, and can increase along with reducing of management data block granularity.But the metadata information of snapshot data is semantic simple, only has a kind of semanteme, so can adopt the mode of bitmap (bitmap) to store and manage such as the such metadata of fast photographic system, this bitmap mode can be saved storage space.By the information that just can describe a data block granularity in the bitmap, namely the change list of each shows the pointer that is indicated to this data block in the bitmap.The bitmap access speed is very fast, and its access is more consistent with the array access mode, need not any traversing operation, and can directly position by the method for calculating.
When the data that are managed are less, can adopt the one-level bitmap to realize the data of additional space are effectively managed; But, take up room when very large when the data that are managed are more, adopt the one-level bitmap to realize will having following two problems to the data management of corresponding very large space:
1) increase of invalid data ratio can cause the waste of storage space.
When data space was very large, some more data may be temporarily invalid concerning calling party, so the ratio of the temporary transient invalid data space of this class will increase greatly; Obviously be these invalid data assignment bit map information in internal memory, the memory source of greatly waste preciousness.
2) access efficiency of bitmap reduces.
At every turn in access during message bit pattern, all need to obtain by the actual value that obtains in the bitmap one pointer of respective data blocks; When the data space that is managed was very large, message bit pattern tended to account for larger memory headroom, so need the support of swapping in and out technology.Therefore only adopt the one-level bitmap to carry out in the situation of metadata management, can do a lot of invalid swapping in and out operations, so that access efficiency reduces greatly.
Summary of the invention
Technical matters to be solved by this invention provides a kind of method and device by bitmap mode management of metadata, can save a large amount of memory headrooms.
In order to solve the problems of the technologies described above, the invention provides a kind of method by bitmap mode management of metadata, comprising:
The file of Preservation Metadata is passed through file directory level bitmap with list structure log file directory information, comprise the unified identifier of first overall situation and first pointer of identification document catalogue; With list structure log file information and file attribute information, this document information comprises the unified identifier of second overall situation of identification document and points to the second pointer of corresponding file attribute information address in the file attribute level bitmap by file and attribute level bitmap thereof; This document attribute information comprises one or more information in title, file size, document creation and/or the modification time of file;
When the next file of access one file directory, obtain the first pointer of the address of pointing to corresponding file record by described file directory level bitmap, and in described file and attribute level bitmap thereof, obtain corresponding fileinfo by this first pointer, obtain the second pointer according to the unified identifier of the overall situation of second in this document information, find corresponding file attribute information according to this second pointer.
Further, the method also comprises:
Know that according to the file attribute information that obtains corresponding file changes, then return the data of the file of change, do not change if know corresponding file, then return the data of this original of not changing.
Further, with tree structure log file changed information, this document changed information records the file data of change by this document attribute level bitmap.
Further, the method also comprises:
Know that according to the file attribute information that obtains corresponding file changes, the file data of the file amendment acquisition of information change by the tree structure record then, and merging in the original returns the file data after the merging; Do not change the original data of then returning not change if know corresponding file.
In order to solve the problems of the technologies described above, the invention provides a kind of device by bitmap mode management of metadata, comprise the file directory level module and file and the attribute level module thereof that connect successively, wherein:
File directory level module is used for the file of Preservation Metadata is passed through file directory level bitmap with list structure log file directory information, comprises the unified identifier of first overall situation and first pointer of identification document catalogue; When the user accesses under the catalogue file, from the file directory information of file directory level figure record, obtain the first pointer of the address of pointing to corresponding file record, and obtain the file record address by this first pointer;
File and attribute level module thereof, be used for by file and attribute level bitmap thereof with list structure log file information and file attribute information, this document information comprises the unified identifier of second overall situation of identification document and points to the second pointer of corresponding file attribute information address in the file attribute level bitmap; This document attribute information comprises one or more information in title, file size, document creation and/or the modification time of file; Obtain corresponding fileinfo according to the file record address from file and attribute level bitmap thereof, obtain the second pointer according to the unified identifier of the overall situation of second in the fileinfo, obtain corresponding file attribute information according to this second pointer.
Further,
File and attribute level module thereof also know that according to the file attribute information that obtains corresponding file changes, then return the file data of change; Do not change if know corresponding file, then return the data of this original of not changing.
Further,
With tree structure log file changed information, this document changed information records the file data of change by file attribute level bitmap.
Further, file and attribute level module thereof comprise file-level unit and the file attribute level unit that connects successively, wherein:
The file-level unit is used for finding corresponding file record by the first pointer at the file-level bitmap, obtains the second pointer according to the unified identifier of second overall situation that records in this document record;
File attribute level unit, the second pointer that is used for obtaining according to the file-level unit obtains corresponding file attribute information from file attribute level bitmap.
Further,
File attribute level unit also knows that by the file attribute information that obtains corresponding file changes, then obtains the file data of change, merges in the original, and returns file data after the merging; Do not change the original data of then returning not change if know corresponding file.
The present invention is by multistage bitmap laminated record file directory, file and file attribute thereof and all kinds of metadata of file update information, thereby realization is to high-level efficiency storage, the management and retrieval of file data.
Embodiment
Below in conjunction with accompanying drawing and preferred embodiment technical scheme of the present invention is described in detail.The embodiment that below exemplifies only is used for description and interpretation the present invention, and does not consist of the restriction to technical solution of the present invention.
Fig. 1 has represented that the present invention is used for the framework of the secondary bitmap embodiment of management of metadata, comprises file directory level and file and attribute level thereof, wherein:
The file directory level is used for the record directory listing, for example with the mode record of data link table; The information of each catalogue comprises catalogue ID and points to the address that next stage bitmap File is tabulated in the directory listing; Wherein the catalogue ID mode of unifying identifier (GUID, Globally Unique IDentifier) with the overall situation generates, and is unique in whole system to guarantee each catalogue;
File and attribute level thereof are used for the file attribute of listed files and All Files under each catalogue of record directory listing, for example with the mode record of data link table; The information of each file comprises file ID and file attribute information in the listed files, one or more information in title, size, establishment and the modification time of this document attribute information include file; Wherein listed files is with the mode record of data link table, and file ID generates in the mode of GUID equally, is unique in whole system to guarantee each file.
The present invention adopts the mode record of above-mentioned two level frameworks with metadata, and wherein the bitmap capacity of file directory level is less, so can memory-resident; File and attribute level bitmap thereof can be saved in the disk unit.One (forming pointer with other position) in the upper level bitmap describes the data block (data block of log file and attribute level thereof) in the next stage bitmap.
When the shared space of the metadata of management is larger, the above-mentioned way that metadata is divided into the two-stage bitmap management of the present invention, can avoid adopting one-level bitmap management mode user once access can have access to many temporary transient invalid data, but when needing, the user just has access to next stage from upper level, both dwindle the space of visit data, also improved simultaneously the efficient of visit data.
Fig. 2 expresses the secondary bitmap that the present invention is directed to management of metadata shown in Figure 1 and the embodiment of the method flow process of the management of metadata that provides comprises:
110: meta data file is recorded file directory information by file directory level figure, and record file and file attribute information by file and attribute level figure thereof;
The file directory level is with the mode log file directory listing of data link table, and the information of each catalogue comprises catalogue ID and points to the address that next stage bitmap File is tabulated in the directory listing.
120: when the user accesses the next file of a file directory, obtain corresponding file and file attribute information address by file directory level bitmap;
Find corresponding pointer in sensing file and the attribute level bitmap thereof by the catalogue ID that records in the file directory level bitmap, and by the corresponding fileinfo of this pointed address.
130: obtain corresponding file record by file and attribute level bitmap thereof, find corresponding file attribute information according to the file ID in the file record;
In file and attribute level bitmap thereof, find corresponding listed files (being file record) by the pointer that points to the fileinfo address, find corresponding file attribute information according to the file ID in the listed files.
140: return corresponding file data, process ends according to file attribute information.
According to file attribute information (such as file name, size, establishment and modification time etc.), if know the file unmodified, then return the original data; Otherwise return the file data of modification.
When the shared space of metadata of management very large, when causing adopting the secondary bitmap also can appearance can access many temporary transient invalid data, be necessary above-mentioned file and attribute level thereof are further divided into secondary, the framework of three grades of bitmap embodiment as shown in Figure 3, that is except comprising the file directory level, file and attribute fraction thereof are become file-level and file attribute level, wherein:
The file directory level, effect is with described in the above-mentioned secondary bitmap framework, and this repeats no more;
File-level, be used for the mode log file tabulation with data link table, the information of each file that records in the listed files comprises file ID and points to the address of next stage bitmap File attribute that its file ID generates in the mode of GUID, is unique to guarantee each file in whole system;
The file attribute level, be used for respectively log file attribute information and file amendment information, wherein file attribute information comprises one or more information in file name, file size, creation-time and the modification time with the list structure record, file amendment information is with the data of tree structure log file change, and tree structure for example adopts B tree or B+ tree.
Fig. 4 expresses three grades of bitmaps that the present invention is directed to management of metadata shown in Figure 3 and the embodiment of the method flow process of the management of metadata that provides comprises:
210: when the user accesses the next file of a file directory, obtain corresponding file record address by the file directory level;
Find corresponding pointer in the sensing file-level bitmap by the catalogue ID that records in the file directory level, and by the corresponding listed files of this pointed (being file record) address.
220: obtain corresponding file attribute address by corresponding file record in the file-level;
File record File ID by file-level finds corresponding pointer in the sensing file attribute level bitmap, and by the corresponding file attribute of this pointed address.
230: obtain corresponding file attribute information by the file attribute level;
Get access to file attribute information and the file amendment information of record by the file attribute level, wherein file attribute information comprises one or more information in file name, file size, creation-time and the modification time; The data of file amendment information recording/file amendment.
240: judging whether corresponding file is changed, is execution in step 250 then, otherwise execution in step 260;
Know according to file attribute information File creation-time and/or modification time information whether file is changed.
250: obtain the file data of change, merge in the original, return the file data after the merging, process ends;
From the file amendment information of corresponding tree structure, get access to the data of file amendment, merge in the original and return.
260: return the original data, process ends.
Above-mentioned way of the present invention, can further avoid adopting one-level or secondary bitmap management mode user once access can have access to many temporary transient invalid data, but when needing, the user just has access to next stage, can further save thus the space of visit data, also further improve simultaneously the efficient of management and visit data.
The present invention is directed to said method embodiment, the device embodiment by bitmap mode management of metadata correspondingly also is provided, its structure comprises the file directory level module and file and the attribute level module thereof that connect successively as shown in Figure 5, wherein:
File directory level module is used for obtaining corresponding file record address from file directory level bitmap when the user accesses under the catalogue file;
File directory level module finds by the catalogue ID that records in the file directory level bitmap and points to corresponding pointer in file and the attribute level bitmap thereof, and by the corresponding listed files of this pointed address.
File and attribute level module thereof are used for obtaining corresponding file record from file and attribute level bitmap thereof, obtain corresponding file attribute information according to the fileinfo in the file record, and return corresponding file data according to file attribute information.
File and attribute level bitmap Further Division thereof are file-level bitmap and file attribute level bitmap, and file and attribute level module thereof further comprise file-level unit and the file attribute level unit that connects successively, wherein:
The file-level unit is used for finding corresponding pointer in the sensing file attribute level bitmap by the file ID that the file-level bitmap records;
File attribute level unit, the pointer that is used for obtaining according to the file-level unit obtains corresponding file attribute information, knows by the file attribute information that obtains whether corresponding file is changed, if the file data of change is then obtained in change, merge in the original, and return file data after the merging; If the original data of obtaining are not then returned in change.
More than explanation only is the better embodiment of the present invention; but protection scope of the present invention is not limited to this; anyly be familiar with those skilled in the art in the technical scope that the present invention discloses, the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claims.