WO2014101583A1 - 键值存储系统中构建文件系统的方法、装置及电子设备 - Google Patents

键值存储系统中构建文件系统的方法、装置及电子设备 Download PDF

Info

Publication number
WO2014101583A1
WO2014101583A1 PCT/CN2013/087316 CN2013087316W WO2014101583A1 WO 2014101583 A1 WO2014101583 A1 WO 2014101583A1 CN 2013087316 W CN2013087316 W CN 2013087316W WO 2014101583 A1 WO2014101583 A1 WO 2014101583A1
Authority
WO
WIPO (PCT)
Prior art keywords
directory
file
keyword
metadata
path
Prior art date
Application number
PCT/CN2013/087316
Other languages
English (en)
French (fr)
Inventor
岳银亮
熊劲
张立新
陈明宇
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP13867294.4A priority Critical patent/EP2924567A4/en
Publication of WO2014101583A1 publication Critical patent/WO2014101583A1/zh
Priority to US14/754,019 priority patent/US20150302111A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/188Virtual file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • G06F16/134Distributed indices

Definitions

  • the present invention relates to the field of data storage, and in particular, to a method, an apparatus, and an electronic device for constructing a file system in a key value storage system.
  • KV (Key-Value, key-value) storage system is a representative of non-relational database, abandoning the relationship between the strict field structure of the data table and the table, and the data stored by the key value is simplified.
  • the data model makes the KV key storage system have the following advantages: First, high scalability, KV key storage system can be easily used in multiple units due to the strict field structure of the data table and the relationship between the tables. Distributed applications are deployed on the server to improve the scalability of the entire system, which is more convenient and flexible. Second, the mass storage and high throughput capacity that meets the needs of cloud computing.
  • the KV key value storage system can meet the flexible requirements of users in the cloud computing environment. Therefore, the KV key value storage system is increasingly becoming the mainstream storage platform.
  • an object of the present invention is to provide a method for constructing a file system in a key value storage system, and the specific implementation is as follows:
  • a first aspect of the method of building a file system in the key value storage system includes:
  • the process of constructing a keyword includes:
  • the directory number corresponding to the directory is used as a keyword of the directory
  • the constructed keyword is a keyword of a complete file
  • the directory number corresponding to the prefix directory of the file is obtained, and information including the directory number and the file name is constructed as a keyword of the file;
  • the directory number corresponding to the prefix directory of the fragment file and the number of each file fragment are obtained, and the configuration includes the directory number, the file name, and The information of the document number is used as the keyword of each file.
  • the present invention also discloses an apparatus for constructing a file system in a key value storage system
  • the first aspect of the apparatus for constructing a file system in the key value storage system includes:
  • a directory number obtaining module configured to acquire a directory of each level in the file storage system, and obtain a directory number corresponding to a directory path of the directory of each level;
  • a keyword construction module configured to construct a keyword of a directory and a file according to the directory number and files stored under each level directory
  • a mapping relationship building module is configured to construct and store a mapping relationship between directory metadata, file metadata, directories, and files and the keywords.
  • mapping relationship construction module includes:
  • the keyword to be built is a directory keyword
  • the directory number corresponding to the directory is used as a keyword of the directory
  • a second building unit configured to acquire a directory number corresponding to a prefix directory of the file when the keyword being built is a keyword of a complete file, and construct information including the directory number and the file name, as The keyword of the file;
  • a third building unit configured to: obtain a directory number corresponding to a prefix directory of the fragment file and a number of each file slice, and construct a directory including the directory number and the file
  • the name and the file number information are used as the keywords of the respective pieces of the file.
  • the present invention also discloses an electronic device comprising the apparatus for constructing a file system in the above key value storage system.
  • the present invention also discloses an electronic device, the electronic device including a processor and a memory connected to the processor, where
  • the processor is configured to obtain a directory of each level in the file storage system, and obtain a directory number corresponding to the directory path of the directory of each level, according to the directory number, and files stored under the directories at each level, Build keywords for directories and files, and build and store mappings of directory metadata, file metadata, directories, and files to the keywords;
  • the memory is configured to store information including a program run by the processor.
  • the method for constructing a file system in the key value storage system disclosed by the present invention first acquires various levels of objects The directory number corresponding to the recorded directory path, and then the corresponding keyword Key of the directory and the file is constructed according to the directory number and the file stored under each directory, in this case, due to the directory number in the keyword Key
  • the occupied space is small, and each directory number is unique, there is no repetition phenomenon, which effectively saves storage space; in addition, a directory keyword Key corresponding to the directory is constructed according to the directory number, and is needed When the directory is operated, the directory to be operated can be obtained directly according to the keyword Key of the directory, and the operation process is simplified.
  • FIG. 1 is a schematic diagram of a Key-Value storage form in a key value storage system
  • FIG. 2 is a schematic flowchart of a method for constructing a file system in a key value storage system according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a workflow of acquiring a file to be read in a method for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of a workflow for acquiring a file to be written in a method for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 5 is a schematic diagram of a workflow of listing files in the same directory in a method for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 6 is a schematic diagram of a workflow of renaming a directory in a method for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 7 is a schematic diagram of a workflow of modifying a path access right of a directory in a method for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 8 is a schematic diagram of a workflow of modifying a path access right of a file in a method for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 9 is a schematic diagram of an apparatus for constructing a file system in a key value storage system according to an embodiment of the present invention. Schematic;
  • FIG. 10 is a schematic structural diagram of a mapping relationship construction module in an apparatus for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 11 is a schematic structural diagram of a reading module in an apparatus for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 12 is a schematic structural diagram of a write module in an apparatus for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 13 is a schematic structural diagram of a module in a device for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 14 is a schematic structural diagram of a renaming module in an apparatus for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 15 is a schematic structural diagram of a directory path authority changing module in a device for constructing a file system in a key value storage system according to an embodiment of the present disclosure
  • FIG. 16 is a schematic structural diagram of a file path authority changing module in an apparatus for constructing a file system in a key value storage system according to an embodiment of the present invention.
  • a keyword that is, a Key
  • data stored in the storage system that is, Value
  • a key is created between Key and Value.
  • the mapping relationship called Key-Value form ⁇ 6, value>, can obtain the data Value stored in the KV key value storage system according to the keyword Key.
  • the method for constructing a file system in the key value storage system includes the following steps:
  • Step S1 Obtain a directory of each level in the file storage system, and obtain a directory number dirid corresponding to the directory path of the directory of each level.
  • the directory number dirid corresponding to each directory is unique, and may be a number such as "1, 2, 3".
  • the directory path of a directory is home/patent/2011dir/"
  • a directory number dirid can be created for the directory path.
  • the directory path of the upper directory is "/home”.
  • /patent/ also known as the prefix directory of the directory, can create another directory number dirid is 2, of course, dirid can also be created in other forms, the invention is not limited.
  • Step S2 Construct a keyword Key of the directory and the file according to the directory number and the file stored under each directory.
  • Step S3 Build and store a mapping relationship between the directory, the file, the directory metadata inode, and the file metadata inode and the keyword Key.
  • the directory metadata inode and the file metadata inode are pre-stored with the directory and the file, the index in the storage system, the user and the access rights, and the like.
  • the mapping between the directory metadata inode, the file metadata inode and the keyword is constructed and stored, and the keyword can be obtained according to the keyword.
  • Metadata to know whether it has the right to operate on it; when it has the right to operate on it, according to the keyword can get the corresponding directory and file to operate on it.
  • the correspondence between the keyword Key and the directory and the file is stored so that a directory or file corresponding thereto can be obtained according to the keyword.
  • the method for constructing a file system in the key value storage system disclosed by the present invention first acquires a directory number corresponding to a directory path of each directory, and then constructs a directory and a file according to the directory number and files stored under each directory.
  • the corresponding keyword Key in this case, because the directory number in the keyword Key occupies a small space, and each directory number is unique, there is no repetition phenomenon, which effectively saves storage space;
  • a directory keyword Key corresponding to the directory is constructed according to the directory number.
  • the directory keyword Key can be directly obtained according to the directory.
  • the directory to be operated the operation process is simplified.
  • step S2 includes:
  • the directory number corresponding to the directory is used as a keyword of the directory
  • the constructed keyword is a keyword of a complete file, obtaining a directory number corresponding to the prefix directory of the file, and constructing information including the directory number and the file name as a keyword of the file;
  • the constructed keyword is a keyword of the fragmented file
  • the directory number corresponding to the prefix directory of the fragment file and the number of each file fragment are obtained, and information including the directory number, the file name, and the file number is constructed. , as a keyword for each of the pieces of the file.
  • the directory number corresponding to the directory path of the directory is used as the directory keyword, and the Key-Value form of the directory is ⁇ dirid, value>, and the number of entries is all levels.
  • the total number of directories For example, if the directory number of the directory path home/patent/2011dir/, is 1, the keyword of the directory is 1 , and the directory can be obtained by the mapping between the keyword and the directory.
  • the keyword of the file includes a directory number and the file name.
  • a file named "patl" is stored, and the file path of the file is: home/patent/2011 dir/pat ⁇ , then "/home/patent/2011 dir” is the prefix directory of the file.
  • the directory number dirid of this prefix directory is 1, the keyword of the file "patl” can be "1/patl".
  • the file Key-Value is of the form ⁇ dirid/filename , value>, and the number of entries is the total number of files.
  • the stored data when the stored data is a file, it can be stored as a complete file, that is, a Value, or after the file is sliced, in the form of multiple file slices, that is, multiple Values. storage.
  • a keyword when a keyword is constructed for a sliced file after the file is sliced, when the keywords of the respective document pieces are constructed, the keyword includes the information of the directory number, the file name, and the file number. For example, if the file "patl" is divided into multiple files, and the number of each file is 1, 2, 3, etc., the keywords of the first file include the directory number of the prefix directory, the file name, and the number of the file. "1" can be expressed in the form of "l/patl/ ⁇ , of course, it can also be expressed in other forms.
  • the file system provides a Portable Operating System Interface (POSIX), and the KV key storage system provides simple I/O input/output interfaces such as PUT placement, GET acquisition, and DELETE deletion.
  • POSIX Portable Operating System Interface
  • KV key storage system provides simple I/O input/output interfaces such as PUT placement, GET acquisition, and DELETE deletion.
  • each interface provided by the KV key value storage system can be connected to the external, upper layer application system.
  • step S1 when the content of the file needs to be read, a keyword corresponding to the file to be read is obtained; when the keyword is obtained, according to the prefix directory of the file to be read and the file name thereof, The keyword of the file, if the file is a fragment file, the keyword may be obtained according to the prefix directory, the file name, and the number of each file slice;
  • Step S12 Acquire, according to the keyword, the metadata inode of the file to be read, determine whether the read access authority is provided according to the metadata, and perform the operation of step S13 when yes, when the step is not performed, perform the step The operation of S14;
  • Step S13 When the read access permission is provided, obtain the file to be read according to the keyword, to perform a read operation;
  • Step S14 ending the operation.
  • the upper application when the read operation is performed, the upper application can obtain the file to be read from the KV key value storage system through the GET interface.
  • the upper layer application intercepts the content of [offset, offset+size] in the KV database according to the start address of the content to be read and the size of the content to be read, and The content is displayed.
  • offset represents the starting address of the I/O operation
  • size refers to the size of an I/O.
  • offset represents the starting address of the content to be read
  • size represents the current data.
  • the size of the output is returned to the upper application display by intercepting the contents of [offset, offset+size), so that the staff can obtain the content to be read in the file. If the file is a fragmented file, after the content of the plurality of file fragments corresponding to [offset, offset+size] is intercepted, the content of the file is spliced according to the file number, and then displayed by the upper application.
  • Step S21 When a data needs to be written into the file, obtain a keyword corresponding to the file to be written; when acquiring the keyword, according to the prefix directory of the file to be read and the file name thereof, Obtaining a keyword of the file, if the file is a fragment file, obtaining the keyword according to a prefix directory, a file name, and a number of each file slice;
  • Step S22 Obtain, according to the keyword, the metadata inode of the file to be written, determine whether the write access authority is provided according to the metadata inode, and perform the operation of step S23 when the write access authority is provided, when not When the access permission is written, the operation of step S24 is performed;
  • Step S23 Acquire the file to be written according to the keyword, to perform a write operation; Step S24, end the current operation.
  • the upper application acquires the file to be written from the KV key value storage system through the GET interface, and then [offset, offset+ in the file data.
  • the size data is updated, and the updated data is placed in the KV key value storage system through the PUT interface.
  • offset refers to the starting address of the data to be written in the file
  • size refers to the size of the data input.
  • the file to be written is a plurality of files, respectively Update each file, and then paste the updated file content into the KV key storage system according to the file number.
  • Step S31 When the column is needed When a file in the same directory is obtained, a keyword corresponding to the directory is obtained; when the keyword is obtained, a corresponding directory number is obtained according to the directory path of the directory, that is, a keyword corresponding to the directory ;
  • Step S32 Obtain a metadata inode of the directory according to the keyword, determine, according to the metadata, whether the file has the right to list the file in the directory, and if yes, perform the operation of step S33. If not, the operation of step S34 is performed;
  • Step S33 when having the permission to list the file in the directory, according to the keyword, List the directory number corresponding to the path of the prefix directory, the same file as the keyword of the directory; Step S34, end this operation.
  • the prefix directory of the file is home/patent/2011dir/".
  • the directory number corresponding to the path is If the keyword to be executed in the operation directory is the same, it indicates that the file is a file stored in the directory.
  • the directory number corresponding to the path of the prefix directory is the same as the keyword of the directory, the implementation is listed. All files in a directory.
  • Step S41 When the directory needs to be renamed, obtain a keyword corresponding to the directory to be renamed;
  • Step S42 Obtain, according to the keyword, a metadata inode of the to-be-renamed directory, and determine, according to the metadata inode, whether to have the right to rename the directory, and when yes, perform the operation of step S43. When not available, performing the operation of step S46;
  • step S43 after the renaming operation is performed on the to-be-renamed directory, the corresponding relationship between the directory number corresponding to the original directory and the re-named directory is constructed and stored.
  • the original directory is a directory that has not been renamed;
  • the renamed directory can be obtained according to the original directory number, and no new directory number needs to be constructed.
  • Step S44 Build and store a directory path of the subdirectory and the nested subdirectory of the renamed directory, and a mapping relationship between the subdirectory and the directory number of the nested subdirectory;
  • the directory paths of the subdirectories and the nested subdirectories in the directory are changed accordingly. Therefore, the directory paths and directories of the subdirectories and nested subdirectories need to be rebuilt.
  • the mapping relationship of the directory number so that when the directory number is used as a keyword, the corresponding directory can be accurately obtained.
  • Step S45 Delete a mapping relationship between the original directory and the directory number in the key value storage system
  • Step S46 ending the operation.
  • step S44 when the correspondence between the original directory and the directory number is deleted, the DELETE may be called. Interface implementation.
  • Step S51 When the permission of the directory needs to be changed, obtain a keyword corresponding to the directory; Step S52, obtain a directory metadata inode corresponding to the keyword according to the keyword, and determine, according to the metadata, whether the pair has a pair The permission of the directory to perform the permission change, when yes, the operation of step S53 is performed, and when not, the operation of step S57 is performed;
  • Step S53 Obtain a keyword corresponding to the parent directory of the directory; when acquiring the keyword corresponding to the parent directory, obtain a directory path of the parent directory according to the prefix directory of the directory, and obtain the The directory number corresponding to the directory path of the parent directory, that is, the corresponding keyword can be obtained;
  • Step S54 Obtain a metadata inode corresponding to the parent directory according to a keyword corresponding to the parent directory, and obtain access authority information of the parent directory path according to the metadata inode;
  • Step S55 Generate, according to the access permission information of the parent directory path, and the updated directory access permission information, the updated path access permission of the directory, and update the directory according to the updated path access permission of the directory.
  • Directory path permission information in the corresponding directory metadata inode Each directory or file has two permissions, namely path access rights and directory or file access rights.
  • the path access authority and the directory or file access authority are stored in respective corresponding directory metadata inodes or file metadata inodes, wherein the directory or file access rights are set by the upper layer application, and the KV key value storage is entered.
  • the path access permission is generated by using the access permission generation rule of the path after obtaining the updated directory or file access right.
  • Step S56 Update path access permission information of the subdirectory under the directory and the nested subdirectory thereof according to the updated path access information of the directory.
  • Step S57 ending the operation.
  • step S56 when the path access permission information of the subdirectory under the directory is updated, the directory after the update path authority is used as the parent directory of the subdirectory, and is transmitted to the KV key value storage system according to the upper application.
  • the subdirectory is used as the parent directory of the nested subdirectory, and the path access right of the nested subdirectory is updated as described above.
  • step S61 when the permission of the file needs to be changed, the keyword corresponding to the file is obtained;
  • step S62 obtaining file metadata corresponding thereto according to the keyword, and determining whether the device has the corresponding information according to the metadata
  • the permission for changing the permission of the file is performed, and when it is provided, the operation of step S63 is performed, and when not, the operation of step S65 is performed;
  • Step S63 Obtain path access permission information of a prefix directory of the file.
  • the keyword corresponding to the prefix directory is first obtained, and the prefix directory metadata inode corresponding to the prefix directory is obtained according to the keyword, and the prefix directory is obtained. Path access rights information.
  • Step S64 Generate path access rights of the updated file according to path access rights information of the prefix directory, and updated file access rights information, and update file path authority information in file metadata corresponding to the file. ;
  • Step S65 ending the operation.
  • the method for constructing a file system in the key value storage system disclosed by the present invention first acquires a directory number corresponding to a directory path of each directory, and then constructs a directory and a file according to the directory number and files stored under each directory.
  • the corresponding keyword Key in this case, because the directory number in the keyword Key occupies a small space, and each directory number is unique, there is no repetition phenomenon, which effectively saves storage space;
  • the directory keyword Key corresponding to the directory is constructed according to the directory number.
  • the directory to be operated can be directly obtained according to the keyword Key of the directory, and the operation process is simplified.
  • each file is at the key value.
  • N records containing the directory need to be taken out from the key value storage system.
  • N records are written to the key value storage system, that is, N operations need to be performed. .
  • each directory corresponds to a directory number, and the number of records corresponding to a directory is equal to the total number M of subdirectories it contains. This number M is much smaller than the number N of records corresponding to a certain directory in the second technical solution of the file full path. For example, when renaming a directory, all M records containing the directory need to be taken out from the key value storage system. After the key is updated, the M records are written to the key value storage system, that is, M times are performed. operating.
  • the number N of operations in the prior art for the directory is much larger than the second t M of the method disclosed in the present scheme.
  • the Key-Value pair when performing each operation, is ⁇ file full path, file content>, and in the method disclosed in the present scheme, the Key-Value pair is ⁇ directory number, directory content> Or ⁇ directory number/file name, file content> or ⁇ directory number/file name/document number, file slice content>, and directory number, directory number/file name and directory number/file name/document number, compared In terms of the full path of the file, the storage space is smaller.
  • the present invention also discloses an apparatus for constructing a file system in a key value storage system.
  • the apparatus includes: a directory number acquisition module 1, a keyword construction module 2, and a mapping relationship construction. Module 3, where
  • the directory number obtaining module 1 is configured to obtain a directory of each level in the file storage system, and obtain a directory number corresponding to the directory path of the directory of each level;
  • the keyword construction module 2 is configured to construct keywords of the directory and the file according to the directory number and the files stored in the directories at each level;
  • the mapping relationship building module 3 is configured to construct and store mapping relationships between directory metadata, file metadata, directories, and files and the keywords.
  • the mapping relationship construction module 3 includes: a first building unit 31, a second building unit 32, and a third building unit 33, wherein
  • the first building unit 31 is configured to use, when the keyword being built is a directory keyword, Record the corresponding directory number as the keyword of the directory;
  • the second constructing unit 32 is configured to: obtain a directory number corresponding to the prefix directory of the file, and construct information including the directory number and the file name, where the keyword is a keyword of the complete file. As a keyword for the file;
  • the third constructing unit 33 is configured to obtain a directory number corresponding to a prefix directory of the fragment file and a number of each file fragment when the keyword of the file that is configured as a fragmented file is obtained, and the directory includes the directory.
  • the information of the number, the file name, and the document number are used as the keywords of the respective pieces of the file.
  • the apparatus for constructing a file system in the key value storage system further includes a reading module 4, the reading module 4 includes: a first keyword acquiring unit 41, and a first judgment a unit 42 and a file acquisition unit 43 to be read, wherein
  • the first keyword obtaining unit 41 is configured to acquire a keyword corresponding to the file to be read when the file content needs to be read;
  • the first determining unit 42 is configured to acquire metadata of the file to be read according to the keyword, and determine whether the read access right is available according to the metadata;
  • the file to be read unit 43 is configured to acquire the file to be read according to the keyword to perform a read operation when the read access right is provided.
  • the apparatus for constructing a file system in the key value storage system further includes a write module 5, where the write module 5 includes: a second keyword acquisition unit 51, and a second determination a unit 52 and a file acquisition unit 53 to be written, wherein
  • the second keyword obtaining unit 51 is configured to: when the data needs to be written into the file, acquire a keyword corresponding to the file to be written;
  • the second determining unit 52 is configured to obtain metadata of the file to be written according to the keyword, and determine whether the file has access permission according to the metadata;
  • the to-be-written file obtaining unit 53 is configured to acquire the file to be written according to the keyword when a write access right is provided, to perform a write operation.
  • the apparatus for constructing a file system in the key value storage system further includes a listing module 6, the listing module 6 including: a third keyword acquisition unit 61, and a third determination Unit 62 and listing unit 63, wherein The third keyword obtaining unit 61 is configured to: when a file in the same directory needs to be listed, obtain a keyword corresponding to the directory;
  • the third determining unit 62 is configured to obtain metadata of the directory according to the keyword, and determine, according to the metadata, whether the file has the right to list the file in the directory;
  • the listing unit 63 is configured to, when having the permission to list the file in the directory, list, according to the keyword, a file whose directory number corresponding to the path of the prefix directory is the same as the keyword of the directory .
  • the apparatus for constructing a file system in the key value storage system further includes a rename module 7, and the rename module 7 includes: a fourth keyword acquisition unit 71, and a fourth determination a unit 72, a rename unit 73, a rename construction unit 74, and a deletion unit 75, wherein
  • the fourth keyword obtaining unit 71 is configured to acquire a keyword corresponding to the directory to be renamed when the directory needs to be renamed;
  • the fourth determining unit 72 is configured to obtain metadata of the to-be-renamed directory according to the keyword, and determine, according to the metadata, whether the user has the right to rename the directory;
  • the renaming unit 73 is configured to: after performing the renaming operation on the to-be-renamed directory, after the renaming operation is performed on the to-be-renamed directory, construct and store the directory number corresponding to the original directory and the renamed Correspondence of the directory, the original directory is a directory that has not been renamed;
  • the renaming construction unit 74 is configured to construct and store a mapping relationship between a subdirectory of the renamed directory and a directory path corresponding to the nested subdirectory and a directory number of the subdirectory and the nested subdirectory;
  • the unit 75 is configured to delete a correspondence between the original directory and the directory number in the file storage system.
  • the apparatus for constructing a file system in the key value storage system further includes: a directory path permission changing module 8, wherein the directory path authority changing module 8 includes: a fifth keyword acquiring unit 81.
  • the fifth determining unit 82 is configured to obtain metadata of a corresponding directory according to the keyword, Determining, according to the metadata, whether the user has permission to change the permission of the directory;
  • the parent directory path authority obtaining unit 83 is configured to acquire a keyword corresponding to the parent directory of the directory when the authority to change the directory is obtained, and obtain the path of the parent directory according to the keyword Access rights information;
  • the directory path access authority update unit 84 is configured to generate an updated path access right of the directory according to the access authority information of the parent directory path and the updated directory access rights information, and update the corresponding directory Directory path permission information in the directory metadata;
  • the subdirectory path access right update unit 85 is configured to update the path access permission information in the directory metadata corresponding to the subdirectory under the directory and the subdirectory corresponding to the nested subdirectory according to the updated path access information of the directory. .
  • the apparatus for constructing a file system in the key value storage system further includes a file path authority change module 9, and the file path authority change module 9 includes: a sixth keyword acquisition unit 91. a sixth judging unit 92, a prefix directory path access authority obtaining unit 93, and a file path access authority updating unit 94, wherein
  • the sixth keyword obtaining unit 91 is configured to acquire a keyword corresponding to the file when the permission of the file needs to be changed;
  • the sixth determining unit 92 is configured to obtain, according to the keyword, file metadata corresponding thereto, and determine, according to the metadata, whether the user has the authority to change the permission of the file;
  • the prefix directory path access authority obtaining unit 93 is configured to acquire a keyword corresponding to the prefix directory of the file when the user has the right to change the file, and obtain the prefix directory according to the keyword. Path access permission information;
  • the file path access authority updating unit 94 is configured to generate path updated access rights of the file according to the path access rights information of the prefix directory and the updated file access rights information, and update the file corresponding to the file File path access rights information in file metadata.
  • the device for constructing a file system in the key value storage system disclosed by the present invention first acquires a directory number corresponding to a directory path of each directory by a directory number acquisition module, and then uses a keyword construction module according to the directory number and each directory.
  • the stored file, the corresponding keyword Key of the directory and the file are constructed, and the mapping relationship between the directory metadata, the file metadata, the directory and the file and the keyword is constructed and stored by the mapping relationship building module.
  • the present invention also discloses an electronic device, where the electronic device includes the device for constructing a file system in the key value storage system, and the device for constructing the file system in the key value storage system includes: a directory number obtaining module,
  • the keyword building block and the mapping relationship building block may further include a reading module, a writing module, a listing module, a rename module, a directory path permission change module, and a file permission change module.
  • the present invention also discloses an electronic device, the electronic device comprising a processor and a memory connected to the processor, wherein
  • the processor is configured to obtain a directory of each level in the file storage system, and obtain a directory number corresponding to the directory path of the directory of each level, according to the directory number, and files stored under the directories at each level, Build keywords for directories and files, and build and store mappings of directory metadata, file metadata, directories, and files to the keywords;
  • the memory is configured to store information including a program run by the processor.
  • the disclosed systems, devices, and methods may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed.
  • Another point, the mutual coupling or straightness shown or discussed The coupling or communication connection may be an indirect coupling or communication connection through some interface, device or unit, and may be in electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separate, and the components displayed as the units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the functions, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, which can store program codes. .

Abstract

本发明涉及数据存储领域,特别是涉及一种键值存储系统中构建文件系统的方法、装置及电子设备。在本发明所公开的键值存储系统中构建文件系统的方法,首先获取各级目录的目录路径对应的目录编号,再根据所述目录编号以及各级目录下所存储的文件,构建目录和文件相应的关键字Key,这种情况下,由于所述关键字Key中的目录编号所占的空间较小,且各个目录编号为唯一的,不存在重复的现象,有效节省了存储空间;另外,根据所述目录编号构建了与所述目录相对应的目录关键字Key,在需要对目录进行操作时,可直接根据目录的关键字Key获取待操作的目录,操作过程得到简化。

Description

键值存储系统中构建文件系统的方法、 装置及电子设备 本申请要求于 2012 年 12 月 31 日提交中国专利局、 申请号为 201210590105.8、 发明名称为"键值存储系统中构建文件系统的方法、 装置及 电子设备"的中国专利申请的优先权, 其全部内容通过引用结合在本申请中。 技术领域 本发明涉及数据存储领域,特别是涉及一种键值存储系统中构建文件系统 的方法、 装置及电子设备。
背景技术
KV ( Key- Value, 键值)存储系统为非关系型数据库的代表, 放弃了关系 型数据库中,数据表严格的字段结构和表格之间的关系限制, 以键值对应存储 的数据, 采用简化的数据模型, 使得 KV键值存储系统具有以下优势: 第一、 高可扩展性, 由于没有数据表严格的字段结构和表格之间的关系限制, KV键 值存储系统可以很容易的在多台服务器上部署分布式应用,从而提升整个系统 的伸缩性, 更加方便灵活; 第二、 适应云计算需求的海量存储和高吞吐能力。 KV键值存储系统可以 4艮好的满足云计算环境下用户对可伸缩性的灵活需求, 因此, KV键值存储系统日益成为主流的存储平台。
与传统基于磁盘或磁盘阵列逻辑地址空间构建文件系统不同的是, 在 KV 键值存储系统中构建文件系统时, 文件系统元数据和数据均必须以 Key- Value 的方式存取, 其中, Key为预设的关键字, Value为数据库中存储的, 与关键 字对应的数据,因此 Key的构成方式 于 KV键值存储系统构建文件系统设 计的关键。
在现有技术中, 构建 Key 的方式主要有两种, 一种是以文件内容的哈希 值作为 Key, 另一种主要是以文件全路径作为 Key。 但是, 发明人在本申请的 研究过程中发现, 这两种构建 Key 的方式存在一定的问题, 例如, 在以文件 内容的哈希值作为 Key 时, 只适用于只读文件的情况下, 否则当文件内容发 生更改时, 将导致其哈希值的改变进而导致 Key的改变, 影响对文件的查找, 因此多采用以文件全路径作为 Key的方式; 但当以文件全路径作为 Key时, 由于文件全路径存在相同的前缀目录,而重复的前缀目录会占用大量的存储空 间, 并且, 在对目录进行操作, 如列出某个目录下的文件或对目录进行重命名 时, 需要首先以同一目录路径为前缀的文件全路径作为 Key, 获取该目录下的 所有文件, 再对该所有文件进行操作, 已完成对目录的相应操作, 操作过程复 杂。
发明内容 有鉴于此,本发明的目的在于提供一种键值存储系统中构建文件系统的方 法, 具体实施方案如下:
所述键值存储系统中构建文件系统的方法的第一方面包括:
获取文件存储系统中的各级目录,并获取与所述各级目录的目录路径相对 应的目录编号;
根据所述目录编号, 以及各级目录下所存储的文件,构建目录和文件的关 键字;
构建并存储目录元数据、文件元数据、 目录和文件与所述关键字的映射关 系。
结合第一方面,在第一方面的第一种可能的实现方式中, 所述构建关键字 的过程包括:
所构建的关键字为目录关键字时,以所述目录对应的目录编号作为所述目 录的关键字;
所构建的关键字为完整的文件的关键字时,获取所述文件的前缀目录对应 的目录编号,构建包括所述目录编号和所述文件名称的信息,作为所述文件的 关键字;
所构建的关键字为分片的文件的关键字时,获取所述分片文件的前缀目录 对应的目录编号以及各个文件片的编号,构建包括所述目录编号、文件名称和 文件片编号的信息, 作为所述各个文件片的关键字。
相应的, 本发明还公开了一种键值存储系统中构建文件系统的装置, 所述 键值存储系统中构建文件系统的装置的第一方面包括:
目录编号获取模块, 用于获取文件存储系统中的各级目录, 并获取与所述 各级目录的目录路径相对应的目录编号;
关键字构建模块,用于根据所述目录编号,以及各级目录下所存储的文件, 构建目录和文件的关键字;
映射关系构建模块, 用于构建并存储目录元数据、 文件元数据、 目录和文 件与所述关键字的映射关系。
结合第一方面,在第一方面的第一种可能的实现方式中, 所述映射关系构 建模块包括:
第一构建单元, 用于所构建的关键字为目录关键字时, 以所述目录对应的 目录编号作为所述目录的关键字;
第二构建单元, 用于所构建的关键字为完整的文件的关键字时, 获取所述 文件的前缀目录对应的目录编号,构建包括所述目录编号和所述文件名称的信 息, 作为所述文件的关键字;
第三构建单元, 用于所构建的关键字为分片的文件的关键字时, 获取所述 分片文件的前缀目录对应的目录编号以及各个文件片的编号,构建包括所述目 录编号、 文件名称和文件片编号的信息, 作为所述各个文件片的关键字。
相应的, 本发明还公开了一种电子设备, 所述电子设备包括上述键值存储 系统中构建文件系统的装置。
另外, 本发明还公开了一种电子设备, 所述电子设备包括处理器和与所述 处理器相连接的存储器, 其中,
所述处理器, 用于获取文件存储系统中的各级目录, 并获取与所述各级目 录的目录路径相对应的目录编号,根据所述目录编号, 以及各级目录下所存储 的文件, 构建目录和文件的关键字, 并构建并存储目录元数据、 文件元数据、 目录和文件与所述关键字的映射关系;
所述存储器, 用于存储包含有所述处理器运行的程序的信息。
在本发明所公开的键值存储系统中构建文件系统的方法,首先获取各级目 录的目录路径对应的目录编号,再根据所述目录编号以及各级目录下所存储的 文件, 构建目录和文件相应的关键字 Key, 这种情况下, 由于所述关键字 Key 中的目录编号所占的空间较小,且各个目录编号为唯一的,不存在重复的现象, 有效节省了存储空间; 另外,根据所述目录编号构建了与所述目录相对应的目 录关键字 Key,在需要对目录进行操作时,可直接根据目录的关键字 Key获取 待操作的目录, 操作过程得到简化。
附图说明 为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施 例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地, 下面描述 中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付 出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1为键值存储系统中, Key- Value存储形态的示意图;
图 2 为本发明实施例公开的一种键值存储系统中构建文件系统的方法的 工作流程示意图;
图 3为本发明实施例公开的一种键值存储系统中构建文件系统的方法中, 获取待读取文件的工作流程示意图;
图 4为本发明实施例公开的一种键值存储系统中构建文件系统的方法中, 获取待写入文件的工作流程示意图;
图 5为本发明实施例公开的一种键值存储系统中构建文件系统的方法中, 列出同一目录下的文件的工作流程示意图;
图 6为本发明实施例公开的一种键值存储系统中构建文件系统的方法中, 对目录进行重命名操作的工作流程示意图;
图 7为本发明实施例公开的一种键值存储系统中构建文件系统的方法中, 修改目录的路径访问权限的工作流程示意图;
图 8为本发明实施例公开的一种键值存储系统中构建文件系统的方法中, 修改文件的路径访问权限的工作流程示意图;
图 9 为本发明实施例公开的一种键值存储系统中构建文件系统的装置的 结构示意图;
图 10 为本发明实施例公开的一种键值存储系统中构建文件系统的装置 中, 映射关系构建模块的结构示意图;
图 11 为本发明实施例公开的一种键值存储系统中构建文件系统的装置 中, 读取模块的结构示意图;
图 12 为本发明实施例公开的一种键值存储系统中构建文件系统的装置 中, 写入模块的结构示意图;
图 13 为本发明实施例公开的一种键值存储系统中构建文件系统的装置 中, 列出模块的结构示意图;
图 14 为本发明实施例公开的一种键值存储系统中构建文件系统的装置 中, 重命名模块的结构示意图;
图 15 为本发明实施例公开的一种键值存储系统中构建文件系统的装置 中, 目录路径权限更改模块的结构示意图;
图 16 为本发明实施例公开的一种键值存储系统中构建文件系统的装置 中, 文件路径权限更改模块的结构示意图。
具体实施方式 下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。基于本发明中的实施例, 本领域普通技术人员在没有作出创造 性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
参见图 1所示的 KV键值存储系统的结构示意图,在 KV键值存储系统中, 预先创建关键字, 即 Key, 并创建存储系统中存储的数据, 即 Value, 同时创 建 Key与 Value之间的映射关系, 称为 Key- Value形态<^6 , value> , 从而能 够根据关键字 Key, 获取 KV键值存储系统中存储的数据 Value。
为了解决现有技术在 KV键值存储系统中,根据关键字 Key构建文件系统 时存在的占用的存储空间大,在根据关键字获取存储系统中存储的数据时, 过 程复杂繁瑣的问题, 本发明提出了一种键值存储系统中构建文件系统的方法。 参见图 2所示的工作流程示意图,所述键值存储系统中构建文件系统的方法包 括以下步骤:
步骤 Sl、 获取文件存储系统中的各级目录, 并获取与所述各级目录的目 录路径相对应的目录编号 dirid。
其中, 每个目录对应的所述目录编号 dirid为唯一的, 可为 " 1、 2、 3" 等 数字编号。 例如, 在文件系 统中 , 某一 目 录的 目 录路径为 home/patent/2011dir/" , 则可为该目录路径创建一个目录编号 dirid为 1。 相 应的, 而上一级目录的目录路径 "/home/patent/" , 也称为该目录的前缀目录, 可创建另一目录编号 dirid为 2, 当然, 也可以以其他形式创建 dirid, 本发明 不做限定。
步骤 S2、 根据所述目录编号, 以及各级目录下所存储的文件, 构建目录 和文件的关键字 Key。
步骤 S3、 构建并存储目录、 文件、 目录元数据 inode和文件元数据 inode 与所述关键字 Key的映射关系。
其中所述目录元数据 inode和文件元数据 inode中预先存储有该目录和文 件, 在存储系统中的索引、 所属用户和访问权限等。
在根据目录编号和目录下所存储的文件构建目录和文件的关键字 Key后, 构建并存储目录元数据 inode, 文件元数据 inode和所述关键字的映射关系后, 能够根据所述关键字获取元数据, 以得知是否具有对其进行操作的权限; 当具 有对其进行操作的权限后,根据关键字能够获取相应的目录和文件, 以对其进 行操作。
将所述关键字 Key和目录与文件之间的对应关系存储, 以便能够根据所 述关键字获取与其相对应的目录或文件。
在本发明所公开的键值存储系统中构建文件系统的方法,首先获取各级目 录的目录路径对应的目录编号,再根据所述目录编号以及各级目录下所存储的 文件, 构建目录和文件相应的关键字 Key, 这种情况下, 由于所述关键字 Key 中的目录编号所占的空间较小,且各个目录编号为唯一的,不存在重复的现象, 有效节省了存储空间; 另外,根据所述目录编号构建了与所述目录相对应的目 录关键字 Key,在需要对目录进行操作时,可直接根据目录的关键字 Key获取 待操作的目录, 操作过程得到简化。
进一步的, 在步骤 S2中所述的构建关键字 Key的过程包括:
当所构建的关键字为目录关键字时,以所述目录对应的目录编号作为所述 目录的关键字;
当所构建的关键字为完整的文件的关键字时,获取所述文件的前缀目录对 应的目录编号,构建包括所述目录编号和所述文件名称的信息,作为所述文件 的关键字;
所构建的关键字为分片的文件的关键字时,获取所述分片文件的前缀目录 对应的目录编号以及各个文件片的编号,构建包括所述目录编号、文件名称和 文件片编号的信息, 作为所述各个文件片的关键字。
当构建的关键字为目录关键字时,将所述目录的目录路径对应的目录编号 作为所述目录关键字即可, 则目录的 Key-Value形态为 <dirid, value>, 条目数 为各级目录的总数。 例如, 设定目录路径 home/patent/2011dir/,, 的目录编号 为 1时, 则该目录的关键字即为 1 , 通过该关键字及目录间的映射关系, 则可 获取该目录。
当所构建的关键字为完整的文件的关键字时,则所述文件的关键字包括目 录编号和所述文件名称。 例如, 在文件系统中, 存储有名为 "patl" 的文件, 该文件的文件路径为: home/patent/2011 dir/pat Γ ,那么 "/home/patent/2011 dir" 则为该文件的前缀目录。 这一前缀目录的目录编号 dirid为 1时, 文件 "patl" 的关键字可为 "1/patl" , 当然, 也可以采用其他形式表示。 这种情况下, 文件 Key-Value形态为 <dirid/filename , value>, 其条目数为文件总数。
在 KV键值存储系统中,当存储的数据为文件时,可以以一个完整的文件, 即一个 Value的形式存储,也可以对文件切片后, 以多个文件片, 即多个 Value 的形式进行存储。 当对文件切片后, 为分片的文件构建关键字时, 构建各个文 件片的关键字时,使所述关键字包括目录编号、文件名称和文件片编号的信息。 例如, 将文件 "patl" 分为多个文件片, 各个文件片的编号为 1、 2、 3等, 则 第一个文件片的关键字包括前缀目录的目录编号、 文件名称和文件片的编号 " 1" , 可以 "l/ patl/Γ 的形式表示, 当然, 也可以采用其他形式表示。
在根据步骤 si至步骤 S3所述的方法实现关键字的构建时,在实际应用中 还需对文件系统进行其他操作, 例如, 读取文件内容、 向文件中写入数据等。 另外, 文件系统对外提供可移植性操作系统接口 (Portable Operating System Interface, POSIX ), 而 KV键值存储系统对外提供的是 PUT放置、 GET 获取、 DELETE删除等简单的 I/O输入 /输出接口。 基于键值存储系统构建的 文件系统中, 可通过调用 KV键值存储系统提供的各个接口与外部, 如上层的 应用系统连接。
参见图 3所示的工作流程示意图,在构建所述关键字后, 当需要读取文件 内容, 即对 KV键值存储系统执行 Read操作时, 包括以下步骤:
步骤 Sl l、 当需要读取文件内容时, 获取与待读取文件相对应的关键字; 在获取所述关键字时,根据所述待读取文件的前缀目录及其文件名称, 即可获 取所述文件的关键字, 若所述文件为分片文件时, 则可根据其前缀目录、 文件 名称及各个文件片的编号, 获取所述关键字;
步骤 S12、 根据所述关键字, 获取所述待读取文件的元数据 inode, 根据 所述元数据判断是否具备读访问权限, 在具备时, 执行步骤 S13的操作, 当不 具备时, 执行步骤 S14的操作;
步骤 S13、在具备读访问权限时,根据所述关键字,获取所述待读取文件, 以执行读取操作;
步骤 S14、 结束本次操作。
上述方法中, 在执行读取操作时, 上层应用程序可通过 GET接口从 KV 键值存储系统中获取所述待读取文件。
在上层应用程序获取所述待读取文件后,上层应用程序会根据待读取内容 的起始地址和待读取内容的大小,截取 KV数据库中 [offset, offset+size)的内容, 并将该内容进行显示。 其中, offset代表 I/O操作的起始地址, size指的是某 次 I/O的大小, 在该方法中, offset则代表本次待读取内容的起始地址, 而 size 代表本次数据输出的大小,通过截取 [offset, offset+size)的内容返回给上层应用 显示, 可使工作人员获得文件内的待读取内容。 若所述文件为分片的文件时, 则在截取 [offset, offset+size)对应的多个文件片内容后,还需按照文件片编号对 文件内容进行拼接后, 由上层应用显示。
参见图 4所示的工作流程示意图,在构建所述关键字后, 当需要向文件中 写入数据, 即执行 Write操作时, 包括以下步骤:
步骤 S21、 当需要向文件中写入数据时, 获取与待写入文件相对应的关键 字; 在获取所述关键字时, 根据所述待读取文件的前缀目录及其文件名称, 即 可获取所述文件的关键字, 若所述文件为分片文件时, 则可根据其前缀目录、 文件名称及各个文件片的编号, 获取所述关键字;
步骤 S22、 根据所述关键字, 获取所述待写入文件的元数据 inode, 根据 所述元数据 inode判断是否具备写访问权限, 在具备写访问权限时, 执行步骤 S23的操作, 当不具备写访问权限时, 执行步骤 S24的操作;
步骤 S23、 根据所述关键字, 获取所述待写入文件, 以执行写入操作; 步骤 S24、 结束本次操作。
与读取文件内容时的操作类似, 在执行写入操作时, 上层应用程序通过 GET接口, 从 KV键值存储系统中获取所述待写入文件, 再对文件数据中的 [offset, offset+size)部分的数据进行更新, 将更新后的数据通过 PUT接口放入 KV键值存储系统中。 这种情况下, offset指的是待写入数据在文件中的起始 地址, size指的是本次数据输入的大小。 在完成写入后, 通过 PUT接口将所 述写入后的文件存储如 KV键值存储系统中。
另外, 在对文件数据中的 [offset, offset+size)部分的数据进行更新, 并将更 新后的数据存入 KV键值存储系统中时, 若待写入文件为多个文件片, 则分别 为各个文件片更新,再根据文件片的编号, 对更新后的文件内容进行拼接后再 写入所述 KV键值存储系统中。
参见图 5所示的工作流程示意图,在构建所述关键字后, 当需要列出同一 目录下的文件, 即对 KV键值存储系统执行 Readdir操作时, 包括以下步骤: 步骤 S31、 当需要列出同一目录下的文件时, 获取与所述目录相对应的关 键字; 在获取所述关键字时, 根据所述目录的目录路径, 获取其对应的目录编 号, 即所述目录相应的关键字;
步骤 S32、 根据所述关键字, 获取所述目录的元数据 inode, 根据所述元 数据判断是否具备列出所述目录下所述文件的权限, 当具备时, 则执行步骤 S33的操作, 当不具备时, 则执行步骤 S34的操作;
步骤 S33、 在具备列出所述目录下所述文件的权限时, 根据所述关键字, 列出前缀目录的路径对应的目录编号, 与所述目录的关键字相同的文件; 步骤 S34、 结束本次操作。
例如, 当名为 "patl" 的文件, 其文件路径为: "/home/patent/2011dir/patl" 时, 该文件的前缀目录则为 home/patent/2011dir/"。 该路径对应的目录编号 与需执行操作目录的关键字相同时, 则说明该文件为该目录下存储的文件, 当 列出前缀目录的路径对应的目录编号与所述目录的关键字相同的文件时,则实 现列出了某一目录下所有的文件。
参见图 6所示的工作流程示意图,在构建所述关键字后, 当需对目录进行 重命名, 即执行 rename操作时, 包括以下步骤:
步骤 S41、 当需要对目录进行重命名时, 获取与待重命名目录相对应的关 键字;
步骤 S42、 根据所述关键字, 获取所述待重命名目录的元数据 inode, 根 据所述元数据 inode判断是否具备对所述目录进行重命名的权限, 当具备时, 执行步骤 S43的操作, 当不具备时, 执行步骤 S46的操作;
步骤 S43、 在具备对所述目录进行重命名的权限时, 对所述待重命名目录 执行重命名操作后,构建并存储原目录对应的目录编号与所述重命名后目录的 对应关系, 所述原目录为未进行重命名操作的目录;
在构建原目录对应的目录编号与重命名后目录的对应关系后,则可根据原 目录编号获取重命名后的目录, 而不需要再构建新的目录编号。
步骤 S44、 构建并存储重命名后目录的子目录和嵌套子目录的目录路径, 与所述子目录和嵌套子目录的目录编号间的映射关系;
在对目录进行重命名操作后,所述目录下的子目录和嵌套子目录的目录路 径会发生相应的改变, 因此, 需要重新构建所述子目录和嵌套子目录的目录路 径与目录和目录编号的映射关系, 以便在根据目录编号作为关键字时, 能够准 确获取相应的目录。
步骤 S45、 删除键值存储系统中, 所述原目录与所述目录编号间的映射关 系;
步骤 S46、 结束本次操作。
在步骤 S44中,删除原目录与目录编号间的对应关系时,可调用 DELETE 接口实现。
参见图 7所示的工作流程示意图,在构建所述关键字后, 当需对目录的路 径进行更改权限, 即执行 chmod操作时, 包括以下步骤:
步骤 S51、 当需要更改目录的权限时, 获取与所述目录相对应的关键字; 步骤 S52、 根据所述关键字, 获取与其相对应的目录元数据 inode, 根据 所述元数据判断是否具备对所述目录进行权限更改的权限, 当具备时,执行步 骤 S53的操作, 当不具备时, 执行步骤 S57的操作;
步骤 S53、 获取所述目录的父目录对应的关键字; 在获取所述父目录对应 的关键字时, 可根据所述目录的前缀目录, 得到所述父目录的目录路径, 再获 取与所述父目录的目录路径对应的目录编号, 即能获取其对应的关键字;
步骤 S54、 根据所述父目录对应的关键字, 获取所述父目录对应的元数据 inode, 根据所述元数据 inode获取所述父目录路径的访问权限信息;
步骤 S55、 根据所述父目录路径的访问权限信息, 和更新的目录访问权限 信息, 生成更新后的所述目录的路径访问权限,根据更新后的所述目录的路径 访问权限, 更新所述目录对应的目录元数据 inode中的目录路径权限信息; 每个目录或文件均有两个权限, 即路径访问权限和目录或文件访问权限。 所述路径访问权限和目录或文件访问权限存者在各自对应的目录元数据 inode 或文件元数据 inode中, 其中, 目录或文件访问权限由上层应用程序设定, 在 入所述 KV键值存储系统中,路径访问权限则在获取到更新后的目录或文件访 问权限后, 利用路径的访问权限生成规则生成。其中目录路径的访问权限生成 规则为: 目录路径访问权限 = 父目录路径访问权限 & 目录访问权限。
步骤 S56、 根据更新后的所述目录的路径访问信息, 更新所述目录下的子 目录及其嵌套子目录的路径访问权限信息;
步骤 S57、 结束本次操作。
步骤 S56中,在更新所述目录下的子目录的路径访问权限信息时,将所述 更新路径权限后的目录作为所述子目录的父目录, 根据上层应用程序传输至 KV键值存储系统的所述子目录的目录访问权限信息, 以及目录路径的访问权 限生成规则, 生成所述子目录的路径访问权限; 在更新所述嵌套子目录的路径访问权限时,将所述子目录作为所述嵌套子 目录的父目录, 按照上述方式, 更新所述嵌套子目录的路径访问权限。
按照上述方案公开的更新路径的访问权限的信息,在某一目录的路径访问 权限更改时, 则更新所述目录下各级子目录、 嵌套子目录的路径访问权限, 并 将更新后的路径访问权限信息存储至其对应的元数据 inode中。
参见图 8所示的工作流程示意图,在构建所述关键字后, 当需对文件进行 更改路径访问权限, 即执行 chmod操作时, 包括以下步骤:
步骤 S61、 当需要更改文件的权限时, 获取与所述文件相对应的关键字; 步骤 S62、 根据所述关键字, 获取与其相对应的文件元数据, 根据所述元 数据判断是否具备对所述文件进行权限更改的权限, 当具备时, 执行步骤 S63 的操作, 当不具备时, 执行步骤 S65的操作;
步骤 S63、 获取所述文件的前缀目录的路径访问权限信息;
具体在获取所述前缀目录的路径访问权限时,首先获取所述前缀目录对应 的关键字, 再根据所述关键字, 获取所述前缀目录对应的前缀目录元数据 inode, 进而获取所述前缀目录的路径访问权限信息。
步骤 S64、 根据所述前缀目录的路径访问权限信息, 和更新的文件访问权 限信息, 生成更新后的所述文件的路径访问权限, 并更新所述文件对应的文件 元数据中的文件路径权限信息;
其中, 文件的路径访问权限生成规则为: 文件路径访问权限 =前缀目录 路径访问权限 & 文件访问权限。
步骤 S65、 结束本次操作。
在本发明所公开的键值存储系统中构建文件系统的方法,首先获取各级目 录的目录路径对应的目录编号,再根据所述目录编号以及各级目录下所存储的 文件, 构建目录和文件相应的关键字 Key, 这种情况下, 由于所述关键字 Key 中的目录编号所占的空间较小,且各个目录编号为唯一的,不存在重复的现象, 有效节省了存储空间; 另外,根据所述目录编号构建了与所述目录相对应的目 录关键字 Key,在需要对目录进行操作时,可直接根据目录的关键字 Key获取 待操作的目录, 操作过程得到简化。
具体来说, 在现有技术中, 以文件全路径作为 Key, 那么每个文件在键值 存储系统中都对应一条记录。 某个目录对应的记录个数 N等于其包含的所有 文件个数 N1及其子目录嵌套包含的所有文件个数 N2的总个数,即 N=N1+N2。 对某个目录进行重命名操作时, 需要从键值存储系统中取出所有 N条包含该 目录的记录, 将 Key更新之后, 再将 N条记录写入键值存储系统, 即需要执 行 N次操作。
而本申请所公开的方法中,每个目录对应一个目录编号, 某个目录对应的 记录个数等于其包含的子目录的总个数 M。 此个数 M远远小于现有以文件全 路径作为关键字 Key的技术方案二中某个目录对应的记录个数 N。 如对某个 目录进行重命名操作时, 需要从键值存储系统中取出所有 M条包含该目录的 记录, 将 Key更新之后, 再将 M条记录写入键值存储系统, 即需执行 M次操 作。
相比较而言, 现有技术中对目录进行操作时的次数 N远远大于本方案公 开的方法中次 t M。 另夕卜, 现有技术中, 在执行每次操作时, Key- Value对为 <文件全路径, 文件内容>, 而本方案公开的方法中, Key- Value对为 <目录编 号, 目录内容 >或<目录编号 /文件名称,文件内容 >或<目录编号 /文件名称 /文件 片编号, 文件片内容 >, 而目录编号、 目录编号 /文件名称和目录编号 /文件名 称 /文件片编号, 相较于文件全路径来说, 所占的存储空间更小。
相应的, 本发明还公开了一种键值存储系统中构建文件系统的装置, 参见 图 9所示的结构示意图, 所述装置包括: 目录编号获取模块 1、 关键字构建模 块 2和映射关系构建模块 3 , 其中,
所述目录编号获取模块 1 , 用于获取文件存储系统中的各级目录, 并获取 与所述各级目录的目录路径相对应的目录编号;
所述关键字构建模块 2, 用于根据所述目录编号, 以及各级目录下所存储 的文件, 构建目录和文件的关键字;
所述映射关系构建模块 3 , 用于构建并存储目录元数据、 文件元数据、 目 录和文件与所述关键字的映射关系。
其中, 参见图 10所示的结构示意图, 所述映射关系构建模块 3包括: 第 一构建单元 31、 第二构建单元 32和第三构建单元 33 , 其中,
所述第一构建单元 31 , 用于所构建的关键字为目录关键字时, 以所述目 录对应的目录编号作为所述目录的关键字;
所述第二构建单元 32, 用于所构建的关键字为完整的文件的关键字时, 获取所述文件的前缀目录对应的目录编号,构建包括所述目录编号和所述文件 名称的信息, 作为所述文件的关键字;
所述第三构建单元 33 , 用于所构建的关键字为分片的文件的关键字时, 获取所述分片文件的前缀目录对应的目录编号以及各个文件片的编号,构建包 括所述目录编号、文件名称和文件片编号的信息,作为所述各个文件片的关键 字。
进一步的, 参见图 11所示的结构示意图, 所述键值存储系统中构建文件 系统的装置还包括读取模块 4,所述读取模块 4包括:第一关键字获取单元 41、 第一判断单元 42和待读取文件获取单元 43 , 其中,
第一关键字获取单元 41 , 用于当需要读取文件内容时, 获取与待读取文 件相对应的关键字;
所述第一判断单元 42, 用于根据所述关键字, 获取所述待读取文件的元 数据, 根据所述元数据判断是否具备读访问权限;
待读取文件获取单元 43 , 用于在具备读访问权限时, 根据所述关键字, 获取所述待读取文件, 以执行读取操作。
进一步的, 参见图 12所示的结构示意图, 所述键值存储系统中构建文件 系统的装置还包括写入模块 5 ,所述写入模块 5包括:第二关键字获取单元 51、 第二判断单元 52和待写入文件获取单元 53 , 其中,
所述第二关键字获取单元 51 , 用于当需要向文件中写入数据时, 获取与 待写入文件相对应的关键字;
所述第二判断单元 52, 用于根据所述关键字, 获取所述待写入文件的元 数据, 根据所述元数据判断是否具备写访问权限;
所述待写入文件获取单元 53 , 用于在具备写访问权限时, 根据所述关键 字, 获取所述待写入文件, 以执行写入操作。
进一步的, 参见图 13所示的结构示意图, 所述键值存储系统中构建文件 系统的装置还包括列出模块 6,所述列出模块 6包括:第三关键字获取单元 61、 第三判断单元 62和列出单元 63 , 其中, 所述第三关键字获取单元 61 , 用于当需要列出同一目录下的文件时, 获 取与所述目录相对应的关键字;
所述第三判断单元 62, 用于根据所述关键字, 获取所述目录的元数据, 根据所述元数据判断是否具备列出所述目录下所述文件的权限;
所述列出单元 63 , 用于在具备列出所述目录下所述文件的权限时, 根据 所述关键字,列出前缀目录的路径对应的目录编号与所述目录的关键字相同的 文件。
进一步的, 参见图 14所示的结构示意图, 所述键值存储系统中构建文件 系统的装置还包括重命名模块 7, 所述重命名模块 7包括: 第四关键字获取单 元 71、 第四判断单元 72、 重命名单元 73、 重命名构建单元 74和删除单元 75 , 其中,
所述第四关键字获取单元 71 , 用于当需要对目录进行重命名时, 获取与 待重命名目录相对应的关键字;
所述第四判断单元 72, 用于根据所述关键字, 获取所述待重命名目录的 元数据, 根据所述元数据判断是否具备对所述目录进行重命名的权限;
所述重命名单元 73 , 用于在具备对所述目录进行重命名的权限时, 对所 述待重命名目录执行重命名操作后,构建并存储原目录对应的目录编号与所述 重命名后目录的对应关系, 所述原目录为未进行重命名操作的目录;
所述重命名构建单元 74, 用于构建并存储重命名后目录的子目录和嵌套 子目录对应的目录路径与所述子目录和嵌套子目录的目录编号间的映射关系; 所述删除单元 75 , 用于删除文件存储系统中, 所述原目录与所述目录编 号间的对应关系。
进一步的, 参见图 15所示的结构示意图, 所述键值存储系统中构建文件 系统的装置还包括: 目录路径权限更改模块 8, 所述目录路径权限更改模块 8 包括: 第五关键字获取单元 81、 第五判断单元 82、 父目录路径权限获取单元 83、 目录路径访问权限更新单元 84和子目录路径访问权限更新单元 85 ,其中, 所述第五关键字获取单元 81 , 用于当需要更改目录路径的访问权限时, 获取与所述目录相对应的关键字;
所述第五判断单元 82, 用于根据所述关键字, 获取相应的目录的元数据, 根据所述元数据判断是否具备对所述目录进行权限更改的权限;
所述父目录路径权限获取单元 83 , 用于在具备对所述目录进行权限更改 的权限时, 获取所述目录的父目录对应的关键字, 并根据所述关键字获取所述 父目录的路径访问权限信息;
所述目录路径访问权限更新单元 84, 用于根据所述父目录路径的访问权 限信息,和更新的目录访问权限信息,生成更新后的所述目录的路径访问权限, 并更新所述目录对应的目录元数据中的目录路径权限信息;
所述子目录路径访问权限更新单元 85 , 用于根据更新后的所述目录的路 径访问信息,更新所述目录下的子目录及其嵌套子目录对应的目录元数据中的 路径访问权限信息。
进一步的, 参见图 16所示的结构示意图, 所述键值存储系统中构建文件 系统的装置还包括文件路径权限更改模块 9, 所述文件路径权限更改模块 9包 括: 第六关键字获取单元 91、 第六判断单元 92、 前缀目录路径访问权限获取 单元 93和文件路径访问权限更新单元 94 , 其中,
所述第六关键字获取单元 91 , 用于当需要更改文件的权限时, 获取与所 述文件相对应的关键字;
所述第六判断单元 92, 用于根据所述关键字, 获取与其相对应的文件元 数据, 根据所述元数据判断是否具备对所述文件进行权限更改的权限;
所述前缀目录路径访问权限获取单元 93 , 用于在具备对所述文件进行权 限更改的权限时, 获取所述文件的前缀目录对应的关键字, 并根据所述关键字 获取所述前缀目录的路径访问权限信息;
所述文件路径访问权限更新单元 94, 用于根据所述前缀目录的路径访问 权限信息, 和更新的文件访问权限信息, 生成更新后的所述文件的路径访问权 限, 并更新所述文件对应的文件元数据中的文件路径访问权限信息。
本发明所公开的键值存储系统中构建文件系统的装置,首先通过目录编号 获取模块获取各级目录的目录路径对应的目录编号,再通过关键字构建模块根 据所述目录编号以及各级目录下所存储的文件,构建目录和文件相应的关键字 Key, 再通过映射关系构建模块构建并存储目录元数据、 文件元数据、 目录和 文件与所述关键字的映射关系。 这种情况下, 由于所述关键字 Key 中的目录 编号所占的空间较小, 且各个目录编号为唯一的, 不存在重复的现象, 有效节 省了存储空间; 另外,根据所述目录编号构建了与所述目录相对应的目录关键 字 Key,在需要对目录进行操作时,可直接根据目录的关键字 Key获取待操作 的目录, 操作过程得到简化。
相应的, 本发明还公开了一种电子设备, 所述电子设备包括上述的键值存 储系统中构建文件系统的装置, 所述键值存储系统中构建文件系统的装置包 括: 目录编号获取模块、 关键字构建模块和映射关系构建模块, 另外, 还可以 包括读取模块、 写入模块、 列出模块、 重命名模块、 目录路径权限更改模块和 文件权限更改模块。
相应的, 本发明还公开了一种电子设备, 所述电子设备包括处理器和与所 述处理器相连接的存储器, 其中,
所述处理器, 用于获取文件存储系统中的各级目录, 并获取与所述各级目 录的目录路径相对应的目录编号,根据所述目录编号, 以及各级目录下所存储 的文件, 构建目录和文件的关键字, 并构建并存储目录元数据、 文件元数据、 目录和文件与所述关键字的映射关系;
所述存储器, 用于存储包含有所述处理器运行的程序的信息。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示 例的单元及算法步骤, 能够以电子硬件、或者计算机软件和电子硬件的结合来 实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用 和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现 所描述的功能, 但是这种实现不应认为超出本发明的范围。
所属领域的技术人员可以清楚地了解到, 为描述的方便和简洁, 上述描述 的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程, 在此不再赘述。
在本申请所提供的几个实施例中, 应该理解到, 所揭露的系统、 装置和方 法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施例仅仅是示意性 的, 例如, 所述单元的划分, 仅仅为一种逻辑功能划分, 实际实现时可以有另 外的划分方式, 例如多个单元或组件可以结合或者可以集成到另一个系统, 或 一些特征可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间的耦合或直 接耦合或通信连接可以是通过一些接口, 装置或单元的间接耦合或通信连接, 可以是电性, 机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为 单元显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方, 或者 也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部 单元来实现本实施例方案的目的。
另外, 在本发明各个实施例中的各功能单元可以集成在一个处理单元中, 也可以是各个单元单独物理存在 ,也可以两个或两个以上单元集成在一个单元 中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用 时, 可以存储在一个计算机可读取存储介质中。 基于这样的理解, 本发明的技 术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以 以软件产品的形式体现出来, 该计算机软件产品存储在一个存储介质中, 包括 若干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者网络设 备等)执行本发明各个实施例所述方法的全部或部分步骤。 而前述的存储介质 包括: U盘、 移动硬盘、 只读存储器(ROM, Read-Only Memory )、 随机存取 存储器(RAM, Random Access Memory ), 磁碟或者光盘等各种可以存储程序 代码的介质。
对所公开的实施例的上述说明, 使本领域专业技术人员能够实现或使用本发 明。 对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的, 本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它 实施例中实现。 因此, 本发明将不会被限制于本文所示的这些实施例, 而是要 符合与本文所公开的原理和新颖特点相一致的最宽的范围。

Claims

权 利 要 求
1、 一种键值存储系统中构建文件系统的方法, 其特征在于, 包括: 获取文件存储系统中的各级目录,并获取与所述各级目录的目录路径相对 应的目录编号;
根据所述目录编号, 以及各级目录下所存储的文件,构建目录和文件的关 键字;
构建并存储目录元数据、文件元数据、 目录和文件与所述关键字的映射关 系。
2、 根据权利要求 1所述的方法, 其特征在于, 所述构建关键字的过程包 括:
所构建的关键字为目录关键字时,以所述目录对应的目录编号作为所述目 录的关键字;
所构建的关键字为完整的文件的关键字时,获取所述文件的前缀目录对应 的目录编号,构建包括所述目录编号和所述文件名称的信息,作为所述文件的 关键字;
所构建的关键字为分片的文件的关键字时,获取所述分片文件的前缀目录 对应的目录编号以及各个文件片的编号,构建包括所述目录编号、文件名称和 文件片编号的信息, 作为所述各个文件片的关键字。
3、 根据权利要求 1所述的方法, 其特征在于, 在构建所述关键字后, 还 包括:
当需要读取文件内容时, 获取与待读取文件相对应的关键字;
根据所述关键字, 获取所述待读取文件的元数据,根据所述元数据判断是 否具备读访问权限;
在具备读访问权限时, 根据所述关键字, 获取所述待读取文件, 以执行读 取操作。
4、 根据权利要求 1所述的方法, 其特征在于, 在构建所述关键字后, 还 包括:
当需要向文件中写入数据时, 获取与待写入文件相对应的关键字; 根据所述关键字, 获取所述待写入文件的元数据,根据所述元数据判断是 否具备写访问权限;
在具备写访问权限时, 根据所述关键字, 获取所述待写入文件, 以执行写 入操作。
5、 根据权利要求 1所述的方法, 其特征在于, 在构建所述关键字后, 还 包括:
当需要列出同一目录下的文件时, 获取与所述目录相对应的关键字; 根据所述关键字, 获取所述目录的元数据,根据所述元数据判断是否具备 列出所述目录下所述文件的权限;
在具备列出所述目录下所述文件的权限时,根据所述关键字, 列出前缀目 录的路径对应的目录编号, 与所述目录的关键字相同的文件。
6、 根据权利要求 1所述的方法, 其特征在于, 在构建所述关键字后, 还 包括:
当需要对目录进行重命名时, 获取与待重命名目录相对应的关键字; 根据所述关键字, 获取所述待重命名目录的元数据,根据所述元数据判断 是否具备对所述目录进行重命名的权限; 在具备对所述目录进行重命名的权限时,对所述待重命名目录执行重命名 操作后, 构建并存储原目录对应的目录编号与所述重命名后目录的对应关系, 所述原目录为未进行重命名操作的目录;
构建并存储重命名后目录的子目录和嵌套子目录对应的目录路径,与所述 子目录和嵌套子目录的目录编号间的映射关系;
删除文件存储系统中, 所述原目录与所述目录编号间的映射关系。
7、 根据权利要求 1所述的方法, 其特征在于, 在构建所述关键字后, 还 包括:
当需要更改目录路径的访问权限时, 获取与所述目录相对应的关键字; 根据所述关键字, 获取相应的目录的元数据,根据所述元数据判断是否具 备对所述目录进行权限更改的权限;
在具备对所述目录进行权限更改的权限时,获取所述目录的父目录对应的 关键字, 并根据所述关键字获取所述父目录的路径访问权限信息;
根据所述父目录路径的访问权限信息, 和更新的目录访问权限信息, 生成 更新后的所述目录的路径访问权限,并更新所述目录对应的目录元数据中的目 录路径权限信息;
根据更新后的所述目录的路径访问信息,更新所述目录下的子目录及其嵌 套子目录对应的目录元数据中的路径访问权限信息。
8、 根据权利要求 1所述的方法, 其特征在于, 在构建所述关键字后, 还 包括:
当需要更改文件的权限时, 获取与所述文件相对应的关键字;
根据所述关键字, 获取与其相对应的文件元数据,根据所述元数据判断是 否具备对所述文件进行权限更改的权限;
在具备对所述文件进行权限更改的权限时,获取所述文件的前缀目录对应 的关键字, 并根据所述关键字获取所述前缀目录的路径访问权限信息;
根据所述前缀目录的路径访问权限信息, 和更新的文件访问权限信息, 生 成更新后的所述文件的路径访问权限,并更新所述文件对应的文件元数据中的 文件路径访问权限信息。
9、 一种键值存储系统中构建文件系统的装置, 其特征在于, 包括: 目录编号获取模块, 用于获取文件存储系统中的各级目录, 并获取与所述 各级目录的目录路径相对应的目录编号;
关键字构建模块,用于根据所述目录编号,以及各级目录下所存储的文件, 构建目录和文件的关键字;
映射关系构建模块, 用于构建并存储目录元数据、 文件元数据、 目录和文 件与所述关键字的映射关系。
10、 根据权利要求 9所述的装置, 其特征在于, 所述映射关系构建模块包 括:
第一构建单元, 用于所构建的关键字为目录关键字时, 以所述目录对应的 目录编号作为所述目录的关键字;
第二构建单元, 用于所构建的关键字为完整的文件的关键字时, 获取所述 文件的前缀目录对应的目录编号,构建包括所述目录编号和所述文件名称的信 息, 作为所述文件的关键字;
第三构建单元, 用于所构建的关键字为分片的文件的关键字时, 获取所述 分片文件的前缀目录对应的目录编号以及各个文件片的编号,构建包括所述目 录编号、 文件名称和文件片编号的信息, 作为所述各个文件片的关键字。
11、 根据权利要求 9所述的装置, 其特征在于, 所述键值存储系统中构建 文件系统的装置还包括读取模块, 所述读取模块包括:
第一关键字获取单元, 用于当需要读取文件内容时, 获取与待读取文件相 对应的关键字;
第一判断单元, 用于根据所述关键字, 获取所述待读取文件的元数据, 根 据所述元数据判断是否具备读访问权限;
待读取文件获取单元, 用于在具备读访问权限时, 根据所述关键字, 获取 所述待读取文件, 以执行读取操作。
12、 根据权利要求 9所述的装置, 其特征在于, 所述键值存储系统中构建 文件系统的装置还包括写入模块, 所述写入模块包括:
第二关键字获取单元, 用于当需要向文件中写入数据时, 获取与待写入文 件相对应的关键字;
第二判断单元, 用于根据所述关键字, 获取所述待写入文件的元数据, 根 据所述元数据判断是否具备写访问权限;
待写入文件获取单元, 用于在具备写访问权限时, 根据所述关键字, 获取 所述待写入文件, 以执行写入操作。
13、 根据权利要求 9所述的装置, 其特征在于, 所述键值存储系统中构建 文件系统的装置还包括列出模块, 所述列出模块包括:
第三关键字获取单元, 用于当需要列出同一目录下的文件时, 获取与所述 目录相对应的关键字;
第三判断单元, 用于根据所述关键字, 获取所述目录的元数据, 根据所述 元数据判断是否具备列出所述目录下所述文件的权限;
列出单元, 用于在具备列出所述目录下所述文件的权限时,根据所述关键 字, 列出前缀目录的路径对应的目录编号与所述目录的关键字相同的文件。
14、 根据权利要求 9所述的装置, 其特征在于, 所述键值存储系统中构建 文件系统的装置还包括重命名模块, 所述重命名模块包括:
第四关键字获取单元, 用于当需要对目录进行重命名时, 获取与待重命名 目录相对应的关键字;
第四判断单元, 用于根据所述关键字, 获取所述待重命名目录的元数据, 根据所述元数据判断是否具备对所述目录进行重命名的权限;
重命名单元, 用于在具备对所述目录进行重命名的权限时,对所述待重命 名目录执行重命名操作后,构建并存储原目录对应的目录编号与所述重命名后 目录的对应关系, 所述原目录为未进行重命名操作的目录;
重命名构建单元,用于构建并存储重命名后目录的子目录和嵌套子目录对 应的目录路径与所述子目录和嵌套子目录的目录编号间的映射关系;
删除单元, 用于删除文件存储系统中, 所述原目录与所述目录编号间的映 射关系。
15、 根据权利要求 9所述的装置, 其特征在于, 所述键值存储系统中构建 文件系统的装置还包括目录路径权限更改模块,所述目录路径权限更改模块包 括:
第五关键字获取单元, 用于当需要更改目录路径的访问权限时, 获取与所 述目录相对应的关键字;
第五判断单元, 用于根据所述关键字, 获取相应的目录的元数据, 根据所 述元数据判断是否具备对所述目录进行权限更改的权限;
父目录路径权限获取单元, 用于在具备对所述目录进行权限更改的权限 时, 获取所述目录的父目录对应的关键字, 并根据所述关键字获取所述父目录 的路径访问权限信息;
目录路径访问权限更新单元, 用于根据所述父目录路径的访问权限信息, 和更新的目录访问权限信息, 生成更新后的所述目录的路径访问权限, 并更新 所述目录对应的目录元数据中的目录路径权限信息;
子目录路径访问权限更新单元,用于根据更新后的所述目录的路径访问信 息 ,更新所述目录下的子目录及其嵌套子目录对应的目录元数据中的路径访问 权限信息。
16、 根据权利要求 9所述的装置, 其特征在于, 所述键值存储系统中构建 文件系统的装置还包括文件路径权限更改模块,所述文件路径权限更改模块包 括:
第六关键字获取单元, 用于当需要更改文件的权限时, 获取与所述文件相 对应的关键字;
第六判断单元, 用于根据所述关键字, 获取与其相对应的文件元数据, 根 据所述元数据判断是否具备对所述文件进行权限更改的权限;
前缀目录路径访问权限获取单元,用于在具备对所述文件进行权限更改的 权限时, 获取所述文件的前缀目录对应的关键字, 并根据所述关键字获取所述 前缀目录的路径访问权限信息;
文件路径访问权限更新单元, 用于根据所述前缀目录的路径访问权限信 息, 和更新的文件访问权限信息, 生成更新后的所述文件的路径访问权限, 并 更新所述文件对应的文件元数据中的文件路径访问权限信息。
17、 一种电子设备, 其特征在于, 包括:
权利要求 9至 16任一项所述的键值存储系统中构建文件系统的装置。
18、 一种电子设备, 其特征在于, 所述电子设备包括处理器和与所述处理 器相连接的存储器, 其中,
所述处理器, 用于获取文件存储系统中的各级目录, 并获取与所述各级目 录的目录路径相对应的目录编号,根据所述目录编号, 以及各级目录下所存储 的文件, 构建目录和文件的关键字, 并构建并存储目录元数据、 文件元数据、 目录和文件与所述关键字的映射关系;
所述存储器, 用于存储包含有所述处理器运行的程序的信息。
PCT/CN2013/087316 2012-12-31 2013-11-18 键值存储系统中构建文件系统的方法、装置及电子设备 WO2014101583A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP13867294.4A EP2924567A4 (en) 2012-12-31 2013-11-18 METHOD, MACHINE AND ELECTRONIC DEVICE FOR CONSTRUCTING A FILE SYSTEM IN A KEY VALUE STORAGE SYSTEM
US14/754,019 US20150302111A1 (en) 2012-12-31 2015-06-29 Method and Apparatus for Constructing File System in Key-Value Storage System, and Electronic Device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210590105.8A CN103902632B (zh) 2012-12-31 2012-12-31 键值存储系统中构建文件系统的方法、装置及电子设备
CN201210590105.8 2012-12-31

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/754,019 Continuation US20150302111A1 (en) 2012-12-31 2015-06-29 Method and Apparatus for Constructing File System in Key-Value Storage System, and Electronic Device

Publications (1)

Publication Number Publication Date
WO2014101583A1 true WO2014101583A1 (zh) 2014-07-03

Family

ID=50993959

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/087316 WO2014101583A1 (zh) 2012-12-31 2013-11-18 键值存储系统中构建文件系统的方法、装置及电子设备

Country Status (4)

Country Link
US (1) US20150302111A1 (zh)
EP (1) EP2924567A4 (zh)
CN (1) CN103902632B (zh)
WO (1) WO2014101583A1 (zh)

Families Citing this family (41)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10198185B2 (en) * 2014-12-31 2019-02-05 Samsung Electronics Co., Ltd. Computing system with processing and method of operation thereof
US10346048B2 (en) 2015-04-10 2019-07-09 Samsung Electronics Co., Ltd. Electronic system with storage management mechanism and method of operation thereof
WO2017088180A1 (zh) * 2015-11-27 2017-06-01 华为技术有限公司 向队列存储数据的方法、装置及设备
US11301422B2 (en) * 2016-02-23 2022-04-12 Samsung Electronics Co., Ltd. System and methods for providing fast cacheable access to a key-value device through a filesystem interface
US10235198B2 (en) 2016-02-24 2019-03-19 Samsung Electronics Co., Ltd. VM-aware FTL design for SR-IOV NVME SSD
US10425483B2 (en) 2016-05-16 2019-09-24 International Business Machines Corporation Distributed client based cache for keys using demand fault invalidation
CN106202367B (zh) 2016-07-07 2019-03-05 腾讯科技(深圳)有限公司 一种对象信息的处理方法及装置
CN106484820B (zh) * 2016-09-26 2020-01-17 华为技术有限公司 一种重命名方法、访问方法及装置
CN107870940B (zh) * 2016-09-28 2021-06-18 杭州海康威视数字技术股份有限公司 一种文件存储方法及装置
US10795760B2 (en) 2017-03-20 2020-10-06 Samsung Electronics Co., Ltd. Key value SSD
US10552062B2 (en) 2017-03-20 2020-02-04 Samsung Electronics Co., Ltd. System and method for storing very large key value objects
US11275762B2 (en) 2017-03-20 2022-03-15 Samsung Electronics Co., Ltd. System and method for hybrid data reliability for object storage devices
US11030155B2 (en) 2017-04-26 2021-06-08 Samsung Electronics Co., Ltd. Key value file system
US10715177B2 (en) 2017-06-20 2020-07-14 Samsung Electronics Co., Ltd. Lossy compression drive
US10691340B2 (en) 2017-06-20 2020-06-23 Samsung Electronics Co., Ltd. Deduplication of objects by fundamental data identification
US20180364937A1 (en) 2017-06-20 2018-12-20 Samsung Electronics Co., Ltd. System and method for managing memory device
US11016932B2 (en) * 2017-09-21 2021-05-25 Alibaba Group Holding Limited Systems, methods, and apparatuses for simplifying filesystem operations utilizing a key-value storage system
CN110109866B (zh) * 2017-12-28 2021-11-09 中移(杭州)信息技术有限公司 一种文件系统目录的管理方法及设备
CN110019016A (zh) * 2017-12-29 2019-07-16 北京忆恒创源科技有限公司 提供逻辑键的kv存储设备及其方法
US20210248107A1 (en) * 2017-12-29 2021-08-12 Beijing Memblaze Technology Co., Ltd Kv storage device and method of using kv storage device to provide file system
US11182694B2 (en) 2018-02-02 2021-11-23 Samsung Electronics Co., Ltd. Data path for GPU machine learning training with key value SSD
US11392544B2 (en) 2018-02-06 2022-07-19 Samsung Electronics Co., Ltd. System and method for leveraging key-value storage to efficiently store data and metadata in a distributed file system
CN110275990B (zh) * 2018-03-14 2021-04-23 北京忆芯科技有限公司 Kv存储的键与值的生成方法及装置
CN113660336B (zh) * 2018-03-30 2024-03-15 北京忆芯科技有限公司 利用kv存储设备的云计算与雾计算系统
CN109165525A (zh) * 2018-08-10 2019-01-08 深圳市智微智能科技开发有限公司 一种嵌入式安全存储数据的方法及相关产品
US11023419B2 (en) * 2018-08-13 2021-06-01 Sap Se Folder key management
CN109101640A (zh) * 2018-08-21 2018-12-28 赛凡信息科技(厦门)有限公司 一种对象数据在文件系统中的分布方案
CN109344650A (zh) * 2018-09-25 2019-02-15 郑州云海信息技术有限公司 一种文件系统的文件权限管理方法、系统及相关装置
CN111209252A (zh) * 2018-11-22 2020-05-29 杭州海康威视系统技术有限公司 一种文件元数据存储方法、装置及电子设备
US11099790B2 (en) 2019-01-10 2021-08-24 Samsung Electronics Co., Ltd. Parallel key value based multithread machine learning leveraging KV-SSDS
CN110659257B (zh) * 2019-09-05 2022-04-22 北京浪潮数据技术有限公司 一种元数据对象修复方法、装置、设备及可读存储介质
CN110795442B (zh) * 2019-09-27 2022-04-22 北京浪潮数据技术有限公司 一种键值更新方法、装置、设备及可读存储介质
CN111008185B (zh) * 2019-10-29 2023-08-18 厦门网宿有限公司 一种数据共享方法、系统及设备
CN111078653B (zh) * 2019-10-29 2023-03-24 厦门网宿有限公司 一种数据存储方法、系统及设备
CN111552666B (zh) * 2020-03-23 2021-02-26 苏州沁游网络科技有限公司 一种资源获取方法、装置、设备及存储介质
CN113590543A (zh) * 2020-04-30 2021-11-02 伊姆西Ip控股有限责任公司 信息处理的方法、设备和计算机程序产品
CN111639151A (zh) * 2020-06-01 2020-09-08 山东汇贸电子口岸有限公司 一种全文检索的高效保存倒排索引方法
CN112015710B (zh) * 2020-08-27 2023-11-21 北京达佳互联信息技术有限公司 一种确定目录分片关系的方法及装置
CN112925755A (zh) * 2021-02-18 2021-06-08 安徽中科美络信息技术有限公司 一种文件系统超长路径智能存储方法及装置
CN113190870A (zh) * 2021-05-27 2021-07-30 新华三技术有限公司 一种Redis数据库访问权限控制方法及装置
CN113779235B (zh) * 2021-09-13 2024-02-02 北京市律典通科技有限公司 一种Word文档大纲识别处理方法及装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101957861A (zh) * 2010-10-18 2011-01-26 江苏大学 新型元数据服务器集群和基于调整表的元数据管理方法
CN102314480A (zh) * 2011-07-05 2012-01-11 万达信息股份有限公司 一种针对海量数据的分布式数据存储方法
CN102819599A (zh) * 2012-08-15 2012-12-12 华数传媒网络有限公司 在一致性哈希数据分布基础上构建层次目录的方法

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5857204A (en) * 1996-07-02 1999-01-05 Ab Initio Software Corporation Restoring the state of a set of files
JP4085255B2 (ja) * 2002-09-26 2008-05-14 富士フイルム株式会社 デジタルカメラ及び画像通信方法
US20050086192A1 (en) * 2003-10-16 2005-04-21 Hitach, Ltd. Method and apparatus for improving the integration between a search engine and one or more file servers
US7716179B1 (en) * 2009-10-29 2010-05-11 Wowd, Inc. DHT-based distributed file system for simultaneous use by millions of frequently disconnected, world-wide users
CN101719141B (zh) * 2009-12-24 2011-09-07 成都市华为赛门铁克科技有限公司 基于目录对象的文件处理方法和系统
US8086896B2 (en) * 2009-12-28 2011-12-27 International Business Machines Corporation Dynamically tracking virtual logical storage units
US8600998B1 (en) * 2010-02-17 2013-12-03 Netapp, Inc. Method and system for managing metadata in a cluster based storage environment
US9489523B2 (en) * 2010-04-08 2016-11-08 University Of Washington Through Its Center For Commercialization Systems and methods for file access auditing
US8689298B2 (en) * 2011-05-31 2014-04-01 Red Hat, Inc. Resource-centric authorization schemes
JP5782364B2 (ja) * 2011-11-08 2015-09-24 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation 複数のファイルを列挙した情報を生成する装置及び方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101957861A (zh) * 2010-10-18 2011-01-26 江苏大学 新型元数据服务器集群和基于调整表的元数据管理方法
CN102314480A (zh) * 2011-07-05 2012-01-11 万达信息股份有限公司 一种针对海量数据的分布式数据存储方法
CN102819599A (zh) * 2012-08-15 2012-12-12 华数传媒网络有限公司 在一致性哈希数据分布基础上构建层次目录的方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2924567A4 *

Also Published As

Publication number Publication date
CN103902632B (zh) 2018-01-02
EP2924567A1 (en) 2015-09-30
EP2924567A4 (en) 2016-04-06
CN103902632A (zh) 2014-07-02
US20150302111A1 (en) 2015-10-22

Similar Documents

Publication Publication Date Title
WO2014101583A1 (zh) 键值存储系统中构建文件系统的方法、装置及电子设备
US10740319B2 (en) Graph-based data models for partitioned data
US10579609B2 (en) Multi-user search system with methodology for bypassing instant indexing
US9734158B2 (en) Searching and placeholders
US8296312B1 (en) Search and update of attributes in file systems
US11914585B2 (en) Servicing queries of a hybrid event index
WO2018201583A1 (zh) 文件管理方法、系统、电子装置及介质
US9195666B2 (en) Location independent files
US9613047B2 (en) Automatic content item upload
US20170193039A1 (en) Servicing queries of an event log
US9183212B2 (en) Representing directory structure in content-addressable storage systems
CN103002027A (zh) 基于键值对系统实现树形目录结构的数据存储系统及方法
WO2013091244A1 (zh) 文件系统中数据的存储方法、访问方法及装置
US9020994B1 (en) Client-based migrating of data from content-addressed storage to file-based storage
EP2275952A1 (en) Method for accessing files of a file system according to metadata and device implementing the method
WO2023179787A1 (zh) 分布式文件系统的元数据管理方法和装置
JP6131648B2 (ja) データ管理システム、情報システム、データ管理方法及び情報システムの制御方法、並びに、それら方法のプログラム及びそのプログラムを記録した記録媒体
US9870430B2 (en) Location-independent links to content at online content management systems
JP4343669B2 (ja) ファイル管理装置,動的名前空間生成方法および動的名前空間生成プログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13867294

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2013867294

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE