[go: up one dir, main page]

WO2018081960A1 - File management method, file system, and server system - Google Patents

File management method, file system, and server system Download PDF

Info

Publication number
WO2018081960A1
WO2018081960A1 PCT/CN2016/104385 CN2016104385W WO2018081960A1 WO 2018081960 A1 WO2018081960 A1 WO 2018081960A1 CN 2016104385 W CN2016104385 W CN 2016104385W WO 2018081960 A1 WO2018081960 A1 WO 2018081960A1
Authority
WO
WIPO (PCT)
Prior art keywords
metadata
data
file
area
management unit
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.)
Ceased
Application number
PCT/CN2016/104385
Other languages
French (fr)
Chinese (zh)
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201680003120.4A priority Critical patent/CN108271420B/en
Priority to PCT/CN2016/104385 priority patent/WO2018081960A1/en
Publication of WO2018081960A1 publication Critical patent/WO2018081960A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers

Definitions

  • the present invention relates to the field of information technology and, more particularly, to a method, a file system, and a server system for managing files.
  • Metadata also known as "data data”
  • Metadata is mainly the directory structure, attribute information of files and directories, and mapping relationships between directories. Metadata is used to implement functions such as quickly finding data, and is internal management information of the file system.
  • each file system adopts various complicated logical or physical overheads.
  • a metadata backup scheme is adopted to ensure the reliability of the metadata, and some important metadata or all metadata in the distributed file system is backed up by using a database or another cluster; or, by using a log or The way snapshots are recorded, the changes in metadata are recorded, and when there is a problem, it can be played back or directly rolled back to the metadata at the most recent point in time to reduce the lost content.
  • the above solution is more complicated or expensive, and therefore requires a more concise metadata protection mechanism.
  • Embodiments of the present invention provide a method, a file system, and a server system for managing files, which can effectively protect metadata.
  • the first aspect provides a method for managing a file in a file system, where the storage area managed by the file system includes a data area and a metadata area; the method includes:
  • Each of the plurality of data fragments, the local metadata of each of the plurality of data fragments, and the metadata of the file are stored in the data area;
  • the metadata for the file is stored in the metadata area.
  • the method for managing a file stores metadata of a file in a data area managed by the file system, in addition to storing metadata of the file in a metadata area managed by the file system, so that when a failure occurs in the metadata area, Metadata is restored through the data area, so that metadata can be effectively protected.
  • storing each of the plurality of data fragments, the local metadata of each of the plurality of data fragments, and the metadata of the file into the data area include:
  • the metadata of the file is stored into an extended sub-region in a local metadata region corresponding to each of the plurality of data segments.
  • the extended sub-area is 512 bytes.
  • storing each of the plurality of data fragments, the local metadata of each of the plurality of data fragments, and the metadata of the file into the data area include:
  • the metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.
  • the data fragmentation, the local metadata of the data fragmentation, and the metadata of the file are downloaded together.
  • the method for managing a file in the embodiment of the present invention stores the metadata of the file and the local metadata of the data fragment into the local metadata area together in the data area, and the added I/O overhead is small, and therefore, can be small. Overhead improves the reliability of metadata.
  • the method further includes:
  • the metadata area fails, the metadata area is restored according to the metadata of the file in the data area.
  • the metadata area is restored according to the metadata of the file in the data area, including:
  • the directory hierarchy relationship in the metadata area is restored according to the metadata of the read file.
  • the data fragmentation list may be scanned, and the metadata of the file in each data fragment local metadata area is read according to the data fragmentation list.
  • the metadata of the file is stored in the last 512 bytes of the local metadata area, the metadata of the file in the 512 bytes is read.
  • the metadata of the file is scanned only by scanning the local metadata area in the data area.
  • each time a metadata of a file is obtained a record is added at the directory level of the metadata area.
  • a hash table may be used to record record relationships that are not currently concatenated.
  • determining a plurality of data fragments of the file to be stored in the file includes:
  • the plurality of data fragments are determined according to the protection mode of the file system.
  • the protection mode of the file system is an EC protection mode.
  • a file system in a second aspect, is provided, the storage area managed by the file system including data a zone and a metadata zone; the file system includes: a file management unit, a data management unit, and a metadata management unit;
  • the file management unit is configured to receive a write file request, determine, according to the write file request, data to be stored of the file and metadata of the file, and determine a plurality of data fragments of the data to be stored of the file; The fragment and the metadata of the file are sent to the data management unit; the metadata of the file is sent to the metadata management unit;
  • the data management unit is configured to determine local metadata of each of the plurality of data fragments; each of the plurality of data fragments, each of the plurality of data fragments The local metadata of the slice and the metadata of the file are stored in the data area;
  • the metadata management unit is configured to store the metadata of the file into the metadata area.
  • the file system of the embodiment of the present invention stores the metadata of the file in the data area managed by the file system, in addition to storing the metadata of the file in the metadata area managed by the file system, so that when the metadata area fails, the data can be passed.
  • the area recovers metadata so that metadata can be effectively protected.
  • the data management unit is specifically configured to:
  • the metadata of the file is stored into an extended sub-region in a local metadata region corresponding to each of the plurality of data segments.
  • the data management unit is specifically configured to:
  • the metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.
  • the data management unit is further configured to read metadata of the file in the data area, and send metadata of the read file to the metadata management unit;
  • the metadata management unit is further configured to recover the metadata area according to the metadata of the file sent by the data management unit.
  • the data management unit is configured to: read metadata of a file in a local metadata area corresponding to each data segment in the data area, and send metadata of the read file to The metadata management unit;
  • the metadata management unit is specifically configured to restore the directory hierarchy relationship in the metadata area according to the metadata of the file sent by the data management unit.
  • the file management unit is specifically configured to determine the multiple data fragments according to the protection mode of the file system.
  • a server system comprising:
  • a storage resource that includes a storage area managed by the file system.
  • a server system including:
  • the storage resource includes a storage area managed by a file system, where the storage area includes a data area and a metadata area;
  • the management unit is configured to perform the method in any of the above possible implementation manners of the first aspect or the first aspect.
  • FIG. 1 is a schematic diagram of a server system to which the technical solution of the embodiment of the present invention is applicable.
  • FIG. 2 is a block diagram of a system in accordance with an embodiment of the present invention.
  • FIG. 3 is a schematic flowchart of a method for managing a file according to an embodiment of the present invention.
  • FIG. 4 is a flow chart of a write file in accordance with an embodiment of the present invention.
  • FIG. 5 is a flow chart of restoring metadata according to an embodiment of the present invention.
  • Figure 6 is a schematic block diagram of a file system in accordance with an embodiment of the present invention.
  • FIG. 7 is a schematic block diagram of a server system in accordance with one embodiment of the present invention.
  • FIG. 8 is a schematic block diagram of a server system in accordance with another embodiment of the present invention.
  • the metadata of the file is additionally saved in the data area in addition to the metadata area.
  • the data area and the metadata area may belong to different fault domains, such as at different logical locations, or at different physical locations. Therefore, the protection of the metadata of the file can be enhanced.
  • the data fragmentation, the local metadata of the data fragment, and the metadata of the file are sent to a storage medium (such as a hard disk, a solid state hard disk, etc.) in the same IO request.
  • a storage medium such as a hard disk, a solid state hard disk, etc.
  • metadata for a file can also be stored in the data area. Therefore, the more the number of data fragments, the more times the metadata is backed up.
  • the method Since the metadata of the file is downloaded along with the data fragmentation, the method has a very small impact on system performance, and can greatly improve the reliability of the metadata of the file.
  • FIG. 1 is a schematic diagram of a server system to which the technical solution of the embodiment of the present invention is applicable.
  • server system 100 can include at least one server 110, each server 110 including a storage resource 101, such as a disk, solid state drive, or other storage resource, to provide storage space.
  • the server 110 may further include a management unit 102, and implements a function of the file system through the management unit 102 to provide an access service of the file system.
  • the data of the file can be stored in the storage resource 101 of any server 110 in a distributed manner; for the non-distributed file system, the data of the file is stored in the storage resource 101 of the corresponding server 110.
  • Each server 110 can be a data and/or metadata node, i.e., can store only data or metadata, as well as both data and metadata.
  • the area of all servers 110 for storing data constitutes a data area managed by the file system, and the area of all servers for storing metadata constitutes a metadata area managed by the file system.
  • the data area and the metadata area are logically separated, physically located on the same node (such as a server), or on different nodes.
  • various management units may be functional modules implemented by a processor, for example, may be programs running in a processor; various management units may also be hardware, for example, Is one or more processors.
  • the various storage resources may be hardware, such as a disk, a solid state hard disk, or a volatile memory; various storage resources may also be logical storage spaces, such as logic generated for virtualizing physical storage resources and managed by the management unit. storage. For the sake of brevity, the details are not described below.
  • FIG. 2 shows a logical system architecture diagram of an embodiment of the present invention.
  • system 200 includes a metadata cluster 210 and a data cluster 220.
  • the metadata cluster 210 and the data cluster 220 may be physically dispersed in different physical nodes, or may share the same physical nodes, but are logically divided.
  • the metadata cluster 210 includes a metadata area 211 for storing metadata of files.
  • the metadata area 211 can be located on one or more nodes.
  • the metadata cluster 210 also includes one or more metadata management units 212 for managing metadata for files in the metadata cluster. Similarly, one or more metadata management units 212 may also be located on one or more nodes.
  • the data cluster 220 includes a data area 221 for storing metadata of files in addition to data for storing files and local metadata.
  • Local metadata can also be called local file system metadata, including information such as the size and creation time of data fragments.
  • the metadata management unit 212 is a functional unit and can be located in a distributed file system composed of a single server or a plurality of servers.
  • the metadata management unit 212 may be software, for example, distributed, may be composed of distributed software running on multiple servers; or may be hardware, for example, a processor composed of multiple servers, which can run The distributed software.
  • the metadata area 211 accepts the management of the metadata management unit 212 and provides a storage space for the data read/written by the metadata management unit 212.
  • the metadata area 211 may be a physical storage medium such as a hard disk or a solid state hard disk of a plurality of servers; or may be a logical storage space such as a storage space logically composed of a plurality of servers.
  • the data management unit 222 and the data area 221 in the data cluster 220 are similar to the metadata management unit 212 and the metadata area 211, respectively, and are not described herein again.
  • the metadata of the local metadata and the file may be stored in one piece in the local metadata area in the data area 221.
  • the local metadata area can be extended, and the extended area is called an extended sub-area of the local metadata area, and the local metadata is still stored in the original area, which is called the sub-area before the expansion, and the metadata of the file is stored in Expand in the sub-area.
  • the local metadata area The space provided by the domain is sufficient to store the metadata of the local metadata and files, or the local metadata area has been extended in advance, and the metadata of the local metadata and the file can be stored separately in the local metadata area.
  • the first sub-area may be a predetermined byte in the local metadata area
  • the second sub-area may be The next predetermined byte in the local metadata area.
  • data area 221 can be located on one or more nodes.
  • each node provides a portion of storage space to collectively form a data area 221.
  • the data cluster 220 also includes one or more data management units 222 for managing data for files in the data cluster, local metadata, and metadata for the files.
  • one or more data management units 222 can also be located on one or more nodes. For example, a plurality of nodes all run data management software, and the whole of these softwares constitutes a data management unit 222.
  • metadata management unit 212 and data management unit 222 are functional units in a file system.
  • it may be a functional unit in the management unit 102 in FIG.
  • the functional units in the file system may also include other functional units for managing the files, which are not limited by the present invention.
  • the metadata area 211 and the data area 221 are storage areas managed by the file system.
  • the storage area managed by the file system and the file system can be set in the server system, for example, the server system 100 in FIG.
  • FIG. 3 is a schematic flowchart of a method 300 for managing files according to an embodiment of the present invention.
  • the storage area managed by the file system includes a data area and a metadata area, for example, the data area 221 and the metadata area 211 in FIG.
  • the method 300 may be performed by a file system in a server system or a server system, for example, may be performed by a management unit in a server system or a file system, and the management unit may specifically be one or more management units.
  • a server system for example, may be performed by a management unit in a server system or a file system, and the management unit may specifically be one or more management units.
  • the following describes a server system as an example.
  • the client When writing a file, the client sends a write file request to the server system.
  • the write file request may include identification information of the file, information of the data to be stored and the access address, and the like.
  • the data to be stored of the file is the real data of the file, that is, the data carrying the content of the file.
  • the identification information of the file indicates which file is to be written, for example, the directory name and the file name.
  • the information of the access address indicates the address to be stored in the data to be stored, for example, specifically The length of the address and address space.
  • the server system determines the data to be stored of the file and the metadata of the file.
  • the data to be stored in the file can be directly carried in the write file request; the metadata of the file can be generated according to the information in the write file request, which is equivalent to being carried in the write file request indirectly.
  • the metadata for this file includes information such as the directory structure of the file, the attributes of the files and directories, and so on.
  • the plurality of data fragments may be determined according to a protection mode of the file system.
  • Determining the data fragment of the data to be stored of the file may logically divide the data to be stored into a plurality of data fragments. For example, an erasure coding (EC) protection mode can be used to divide a file into multiple data fragments.
  • EC erasure coding
  • the foregoing steps 310-330 may be specifically performed by a file management unit in the system, and then the file management unit sends the plurality of data fragments and the metadata of the file to the data management unit in the system.
  • the data to be stored in the file is divided into data fragments and stored in the data area managed by the file system.
  • each data fragment has corresponding local metadata
  • the local metadata includes information such as the size and creation time of the data fragment.
  • Local metadata is also stored in the data area, and can be stored locally in the local metadata area of the data area.
  • the server system determines local metadata for each data slice. Specifically, if there is no corresponding local metadata before, local metadata is generated according to the new data fragment; if local metadata is already present, the local metadata is modified according to the new data fragment.
  • each data slice, the local metadata of each data slice, and the metadata of the file are stored in a data area.
  • the local metadata of each data slice and the metadata of the file may be stored in one piece into a local metadata area in the data area.
  • the data area may also be divided into two parts, one part for storing data fragments, which may be referred to as a data fragment area, and the other part for storing metadata, which may be referred to as a local metadata area. It is to be understood that the above-described two regions may be other embodiments, and the specific description is not to be construed as limiting the invention.
  • the metadata of the file and the local metadata of each data slice are stored in a local metadata area.
  • the local metadata area in the embodiment of the present invention is large compared to the case of storing only local metadata of data fragments.
  • the technical solution of the embodiment of the present invention uses a larger local metadata area or extends the local metadata area.
  • a local metadata area in the data area corresponding to each data fragment of the plurality of data fragments may be expanded
  • the metadata of the file is stored into an extended sub-region in a local metadata region corresponding to each of the plurality of data segments.
  • the local metadata area corresponding to the data fragment is expanded, and the metadata of the file is stored in the extended sub-area in the local metadata area. That is to say, the local metadata is still stored in the original area, and the metadata of the file is stored in the extended sub-area.
  • the local metadata area corresponding to each data slice can be extended by 512 bytes, and the metadata of the file is filled in the extended area.
  • each of the plurality of data fragments may be stored into a corresponding data fragment area in the data area;
  • the metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.
  • the local metadata area can be set large enough in advance, so that the metadata of the file can be directly stored to a specific sub-area in the local metadata area.
  • the local metadata area can be divided into two sub-areas, the former sub-area stores local metadata, and the latter sub-area stores metadata of the file.
  • the local metadata of the data fragmentation and the metadata of the file are downloaded, the corresponding data may be processed in the cache, and then the disk is written down to the disk. In this way, the metadata of the file and the local metadata are stored in the local metadata area without increasing the I/O overhead.
  • the above steps 340 and 350 may be specifically performed by a data management unit in the system.
  • the data management unit sends a write success message to the file management unit, the write success message indicating that the data fragmentation and the metadata of the file are successfully written.
  • the file management unit then transmits the metadata of the file to the metadata management unit in the system to request the metadata management unit to update the metadata of the file.
  • the server system updates the metadata of the file in the metadata area of the file system management.
  • the step may be performed after the data area is successfully written, or may be performed in parallel with the write processing of the data area, which is not limited by the present invention.
  • the foregoing step 360 may be specifically performed by a metadata management unit in the system. Then, the metadata management unit sends a write success message to the file management unit, the write success message indicating that the metadata of the file is successfully written. The file management unit then sends a file write success message to the client.
  • the method for managing a file stores metadata of a file in a data area managed by the file system, in addition to storing metadata of the file in a metadata area managed by the file system, so that when a failure occurs in the metadata area, Metadata is restored through the data area, so that metadata can be effectively protected.
  • the method for managing a file in the embodiment of the present invention stores the metadata of the file and the local metadata of the data fragment into the local metadata area in the data area, and the added I/O overhead is small, so A small overhead increases the reliability of metadata.
  • the method 300 may further include:
  • the metadata area fails, the metadata area is restored according to metadata of the file in the data area.
  • the metadata of the file is also stored in the data area, when the metadata area fails, the metadata of the metadata area can be restored by scanning the metadata of the data area.
  • the local metadata area corresponding to each data fragment in the data area can be read.
  • the metadata of the file based on the metadata of the read file, restore the directory hierarchy in the metadata area.
  • the data fragment list may be scanned, and the metadata of the files in each data fragment local metadata area is read according to the data fragmentation list. For example, if the metadata of the file is stored in the last 512 bytes of the local metadata area, the metadata of the file in the 512 bytes is read.
  • a record is added to the directory hierarchy of the metadata area.
  • a hash table may be used to record record relationships that are not currently concatenated. After all the records are collected, the directory hierarchy of the metadata area is established.
  • the scanning process may be performed by the data management unit, and the metadata of the read file is sent to the metadata management unit; the directory hierarchy relationship establishing process may be performed by the metadata management unit, and after the establishment is completed, A recovery success message is sent to the file management unit, indicating that the metadata area has been restored.
  • each management unit in FIG. 4 and FIG. 5 is a functionally divided management unit, which may be physically disposed on the same node or on different nodes.
  • the mutual relationship and function of each management unit in FIG. 4 and FIG. 5, and the relationship with other components in the system, etc. can be referred to the description in the foregoing various embodiments.
  • FIG. 4 is a flow chart of writing a file according to an embodiment of the present invention.
  • the client sends a write file request.
  • the client sends a write file request to the server system and sends it to the file management unit.
  • the write file request may include identification information of the file, information of the data to be stored and the access address, and the like.
  • the file management unit determines data to be stored of the file and metadata of the file.
  • the metadata for this file includes information such as the directory structure of the file, the attributes of the files and directories, and so on.
  • the file management unit determines a plurality of data fragments of the file to be stored.
  • the file may be divided into multiple data fragments according to a protection mode of the file system, such as an EC protection mode.
  • a protection mode of the file system such as an EC protection mode.
  • the file management unit sends the plurality of data fragments and the metadata of the file to the data management unit.
  • the data management unit writes the received data into the cache.
  • the data management unit determines local metadata.
  • the local metadata includes information such as the size of the data slice, the creation time, and the like.
  • the data management unit determines local metadata of each data slice according to the plurality of data fragments.
  • the data management unit fills in the metadata of the file in the local metadata area.
  • the data management unit expands the local metadata area of each data slice by 512 bytes, and fills in the metadata of the file in the extended area; or, the data management unit is in the back 512 of the pre-expanded local metadata area. Fill in the metadata of the file in bytes.
  • the data management unit discards the data fragmentation, the local metadata of the data fragment, and the metadata of the file.
  • the data management unit stores the data fragmentation, the local metadata of the data fragmentation, and the metadata of the file together in the data area.
  • the data management unit responds to the file management unit data fragmentation and the metadata of the file is successfully written.
  • the file management unit sends a request to the metadata management unit to request metadata of the updated file.
  • the metadata management unit stores the metadata of the file into the metadata area.
  • the metadata management unit returns a metadata write success message to the file management unit.
  • the file management unit returns a file write success message to the client.
  • FIG. 5 is a flow chart of restoring metadata according to an embodiment of the present invention.
  • the data management unit scans the data fragment list.
  • the data management unit scans the data slice list, and for each data slice, the following operations are performed.
  • the data management unit reads the metadata of the file in each of the fragment local metadata areas according to the data fragmentation list.
  • the metadata of the file is stored in the last 512 bytes of the local metadata area, the metadata of the file in the 512 bytes is read.
  • the data management unit sends the metadata of the read file to the metadata management unit.
  • the metadata management unit restores the directory hierarchy relationship according to the metadata of the received file.
  • the metadata management unit receives the metadata of a file, it adds a record at the directory level of the metadata area.
  • a hash table may be used to record record relationships that are not currently connected in series. After all the records are collected, the directory hierarchy of the metadata area is established.
  • the metadata management unit sends a recovery success message to the file management unit.
  • the metadata management unit After the metadata area is restored, the metadata management unit notifies the file management unit that the metadata area has been restored, so that the file service is restored.
  • the size of the sequence numbers of the above processes does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not be taken to the embodiments of the present invention.
  • the implementation process constitutes any limitation.
  • FIG. 6 shows a schematic block diagram of a file system 600 in accordance with an embodiment of the present invention.
  • the storage area managed by the file system 600 includes a data area and a metadata area. As shown in FIG. 6, the file system 600 can include a file management unit 610, a data management unit 620, and a metadata management unit 630.
  • the file management unit 610 is configured to receive a write file request, determine, according to the write file request, data to be stored of the file and metadata of the file, and determine a plurality of data fragments of the file to be stored; The data fragment and the metadata of the file are sent to the data management unit 620; the metadata of the file is sent to the metadata management unit 630.
  • the data management unit 620 is configured to determine local metadata of each of the plurality of data fragments, and slice each of the plurality of data fragments, and each of the plurality of data fragments The local metadata of the slice and the metadata of the file are stored in the data area.
  • the metadata management unit 630 is configured to store the metadata of the file into the metadata area.
  • the file system of the embodiment of the present invention stores the metadata of the file in the data area managed by the file system, in addition to storing the metadata of the file in the metadata area managed by the file system, so that when the metadata area fails, the data can be passed.
  • the area recovers metadata so that metadata can be effectively protected.
  • the data management unit 620 is specifically configured to:
  • the metadata of the file is stored into an extended sub-region in a local metadata region corresponding to each of the plurality of data segments.
  • the data management unit 620 is specifically configured to:
  • the metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.
  • the data management unit 620 is further configured to read the metadata of the file in the data area, and send the metadata of the read file to the metadata management unit 630;
  • the metadata management unit 630 is further configured to recover the metadata area according to the metadata of the file sent by the data management unit 620.
  • the data management unit 620 is specifically configured to: read metadata of a file in a local metadata area corresponding to each data fragment in the data area, and read the file. Metadata is sent to the metadata management unit 630;
  • the metadata management unit 630 is specifically configured to restore the directory hierarchy relationship in the metadata area according to the metadata of the file sent by the data management unit 620.
  • the file management unit 610 is specifically configured to determine the multiple data fragments according to the protection mode of the file system.
  • the file system 600 of the embodiment of the present invention may perform the method for managing files according to the embodiment of the present invention, and the foregoing and other operations and/or functions of the respective units in the file system 600 may be referred to the foregoing in order to implement the corresponding processes of the foregoing respective methods.
  • FIG. 7 shows a schematic block diagram of a server system 700 in accordance with one embodiment of the present invention.
  • the server system 700 can include:
  • a storage resource 710 includes a storage area managed by the file system 600.
  • FIG. 8 shows a schematic block diagram of a server system 800 in accordance with another embodiment of the present invention.
  • the server system 800 can include:
  • a storage resource 810 which includes a storage area managed by a file system, the storage area including a data area and a metadata area;
  • the management unit 820 is configured to:
  • Each of the plurality of data fragments, the local metadata of each of the plurality of data fragments, and the metadata of the file are stored in the data area;
  • the metadata for the file is stored in the metadata area.
  • the metadata of the file in addition to storing the metadata of the file in the metadata area managed by the file system, the metadata of the file is also stored in the data area managed by the file system, so that when the metadata area fails, the data can be passed.
  • the area recovers metadata so that metadata can be effectively protected.
  • the management unit 820 is specifically configured to:
  • the management unit 820 is specifically configured to:
  • the metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.
  • the management unit 820 is further configured to:
  • the metadata area fails, the metadata area is restored according to the metadata of the file in the data area.
  • the management unit 820 is specifically configured to:
  • the directory hierarchy relationship in the metadata area is restored according to the metadata of the read file.
  • the management unit 820 is specifically configured to:
  • the plurality of data fragments are determined according to the protection mode of the file system.
  • the management unit 820 in the server system 800 of the embodiment of the present invention may perform the various processes in the foregoing method embodiments. For the specific description, reference may be made to the foregoing embodiments, and details are not described herein for brevity.
  • the term "and/or” is merely an association relationship describing an associated object, indicating that there may be three relationships.
  • a and/or B may indicate that A exists separately, and A and B exist simultaneously, and B cases exist alone.
  • the character "/" in this article generally indicates that the contextual object is an "or" relationship.
  • the disclosed systems, devices, and methods may be implemented in other manners.
  • 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.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, or an electrical, mechanical or other form of connection.
  • the units described as separate components may or may not be physically separated, and the components displayed as 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 embodiments of the present invention.
  • 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 above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention contributes in essence or to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included 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 mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A file management method, a file system, and a server system. The method comprises: receiving a file write request; determining to-be-stored data of the file and metadata of the file according to the file write request; determining multiple data fragments of the to-be-stored data of the file; determining local metadata of each of the multiple data fragments; storing each of the multiple data fragments, the local metadata of each of the multiple data fragments and the metadata of the file into a data region; and storing the metadata of the file into a metadata region. By means of the solution, metadata can be effectively protected.

Description

管理文件的方法、文件系统和服务器系统Method of managing files, file system and server system 技术领域Technical field

本发明涉及信息技术领域,并且更具体地,涉及一种管理文件的方法、文件系统和服务器系统。The present invention relates to the field of information technology and, more particularly, to a method, a file system, and a server system for managing files.

背景技术Background technique

分布式文件系统是一个比较复杂的系统,其管理的数据一般可以简化为数据和元数据两个集群。数据就是用户看到的真实的数据,基本上指的就是文件的真实内容。元数据又称为“数据的数据”,主要是目录结构、文件和目录的属性信息以及目录间的映射关系等。元数据用来实现快速查找数据等功能,是文件系统内部管理信息。A distributed file system is a relatively complex system, and the data it manages can be simplified into two clusters of data and metadata. Data is the real data that users see, basically referring to the real content of the file. Metadata, also known as "data data", is mainly the directory structure, attribute information of files and directories, and mapping relationships between directories. Metadata is used to implement functions such as quickly finding data, and is internal management information of the file system.

在当前的文件系统机制中要想能找到一个文件或者查找它的信息,都是从根目录开始层层目录查找,最终找到一个文件,然后打开这个文件。整个层级关系都是靠元数据记录下来的。如果元数据集群崩溃,即使数据都没有损坏,我们也没法再把这些数据组织起来,已经没法把数据和它的目录甚至文件名做任何的关联,也就无法实现文件的查找等功能。In the current file system mechanism, if you want to find a file or find its information, you should start from the root directory to find a file, and then open the file. The entire hierarchical relationship is recorded by metadata. If the metadata cluster crashes, even if the data is not corrupted, we can't organize the data anymore. We can't associate the data with its directory or even the file name, and we can't implement the file search function.

当前,为了保证元数据集群的可靠性,各个文件系统采用了各种复杂的逻辑或者物理开销。例如,采用了元数据备份的方案来保证元数据的可靠性,将分布式文件系统中的部分重要元数据或者全部的元数据,采用数据库或者另外的一种集群做备份;或者,采用日志或者快照的方式,记录元数据的变更,出现问题时能够回放或者直接回滚到最近一个时间点的元数据,减少丢失的内容。上述方案比较复杂或者开销较大,因此,需要一种更简洁的元数据保护机制。Currently, in order to ensure the reliability of the metadata cluster, each file system adopts various complicated logical or physical overheads. For example, a metadata backup scheme is adopted to ensure the reliability of the metadata, and some important metadata or all metadata in the distributed file system is backed up by using a database or another cluster; or, by using a log or The way snapshots are recorded, the changes in metadata are recorded, and when there is a problem, it can be played back or directly rolled back to the metadata at the most recent point in time to reduce the lost content. The above solution is more complicated or expensive, and therefore requires a more concise metadata protection mechanism.

发明内容Summary of the invention

本发明实施例提供了一种管理文件的方法、文件系统和服务器系统,能够有效地保护元数据。Embodiments of the present invention provide a method, a file system, and a server system for managing files, which can effectively protect metadata.

第一方面,提供了一种文件系统中管理文件的方法,该文件系统管理的存储区域包括数据区域和元数据区域;该方法包括:The first aspect provides a method for managing a file in a file system, where the storage area managed by the file system includes a data area and a metadata area; the method includes:

接收写文件请求; Receiving a write file request;

根据该写文件请求,确定文件的待存储数据和该文件的元数据;Determining data to be stored of the file and metadata of the file according to the write file request;

确定该文件的待存储数据的多个数据分片;Determining a plurality of data segments of the file to be stored;

确定该多个数据分片中每个数据分片的本地元数据;Determining local metadata of each of the plurality of data segments;

将该多个数据分片中每个数据分片、该多个数据分片中每个数据分片的本地元数据和该文件的元数据存储到该数据区域;Each of the plurality of data fragments, the local metadata of each of the plurality of data fragments, and the metadata of the file are stored in the data area;

将该文件的元数据存储到该元数据区域。The metadata for the file is stored in the metadata area.

本发明实施例的管理文件的方法,除了在文件系统管理的元数据区域存储文件的元数据,还在文件系统管理的数据区域存储文件的元数据,这样,在元数据区域发生故障时,可以通过数据区域恢复元数据,从而能够有效地保护元数据。The method for managing a file according to the embodiment of the present invention stores metadata of a file in a data area managed by the file system, in addition to storing metadata of the file in a metadata area managed by the file system, so that when a failure occurs in the metadata area, Metadata is restored through the data area, so that metadata can be effectively protected.

在一些可能的实现方式中,将该多个数据分片中每个数据分片、该多个数据分片中每个数据分片的本地元数据和该文件的元数据存储到该数据区域,包括:In some possible implementations, storing each of the plurality of data fragments, the local metadata of each of the plurality of data fragments, and the metadata of the file into the data area, include:

扩展该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域;Expanding a local metadata area in the data area corresponding to each of the plurality of data fragments;

将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的本地元数据区域中的扩展前的子区域;And storing the local metadata of each of the plurality of data fragments into the pre-expansion sub-area in the corresponding local metadata area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的本地元数据区域中的扩展子区域。The metadata of the file is stored into an extended sub-region in a local metadata region corresponding to each of the plurality of data segments.

在一些可能的实现方式中,该扩展子区域为512个字节。In some possible implementations, the extended sub-area is 512 bytes.

在一些可能的实现方式中,将该多个数据分片中每个数据分片、该多个数据分片中每个数据分片的本地元数据和该文件的元数据存储到该数据区域,包括:In some possible implementations, storing each of the plurality of data fragments, the local metadata of each of the plurality of data fragments, and the metadata of the file into the data area, include:

将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的在该数据区域中的本地元数据区域中的第一子区域;And storing local metadata of each of the plurality of data fragments into a corresponding first sub-area in the local metadata area in the data area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域中的第二子区域。 The metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.

在一些可能的实现方式中,将数据分片、数据分片的本地元数据和文件的元数据一起下盘。In some possible implementations, the data fragmentation, the local metadata of the data fragmentation, and the metadata of the file are downloaded together.

本发明实施例的管理文件的方法,在数据区域,文件的元数据和数据分片的本地元数据一起存储到本地元数据区域,增加的I/O开销很少,因此,能够以很小的开销提高元数据的可靠性。The method for managing a file in the embodiment of the present invention stores the metadata of the file and the local metadata of the data fragment into the local metadata area together in the data area, and the added I/O overhead is small, and therefore, can be small. Overhead improves the reliability of metadata.

在一些可能的实现方式中,该方法还包括:In some possible implementations, the method further includes:

在该元数据区域发生故障时,根据该数据区域中的文件的元数据,对该元数据区域进行恢复。When the metadata area fails, the metadata area is restored according to the metadata of the file in the data area.

在一些可能的实现方式中,根据该数据区域中的文件的元数据,对该元数据区域进行恢复,包括:In some possible implementations, the metadata area is restored according to the metadata of the file in the data area, including:

读取该数据区域中每个数据分片对应的本地元数据区域中的文件的元数据;Reading metadata of a file in a local metadata area corresponding to each data slice in the data area;

根据读取的文件的元数据,恢复该元数据区域中的目录层级关系。The directory hierarchy relationship in the metadata area is restored according to the metadata of the read file.

在一些可能的实现方式中,在元数据区域发生故障时,可以扫描数据分片列表,按照数据分片列表读取每个数据分片本地元数据区域中的文件的元数据。In some possible implementation manners, when a failure occurs in the metadata area, the data fragmentation list may be scanned, and the metadata of the file in each data fragment local metadata area is read according to the data fragmentation list.

在一些可能的实现方式中,若文件的元数据存储在本地元数据区域的后512个字节中,则读取该512个字节中文件的元数据。In some possible implementations, if the metadata of the file is stored in the last 512 bytes of the local metadata area, the metadata of the file in the 512 bytes is read.

在一些可能的实现方式中,扫描文件的元数据时只需要扫描数据区域中的本地元数据区域。In some possible implementations, the metadata of the file is scanned only by scanning the local metadata area in the data area.

在本发明实施例的元数据区域恢复流程中,只需扫描数据区域中的特定区域,因此恢复流程比较简单。In the metadata area recovery process of the embodiment of the present invention, only a specific area in the data area is scanned, so the recovery process is relatively simple.

在一些可能的实现方式中,每得到一条文件的元数据,就在元数据区域的目录层级上添加一条记录。In some possible implementations, each time a metadata of a file is obtained, a record is added at the directory level of the metadata area.

在一些可能的实现方式中,可以采用hash表记录暂时没有串联起来的记录关系。In some possible implementations, a hash table may be used to record record relationships that are not currently concatenated.

在一些可能的实现方式中,确定该文件的待存储数据的多个数据分片,包括:In some possible implementations, determining a plurality of data fragments of the file to be stored in the file includes:

根据该文件系统的保护模式,确定该多个数据分片。The plurality of data fragments are determined according to the protection mode of the file system.

在一些可能的实现方式中,该文件系统的保护模式为EC保护模式。In some possible implementations, the protection mode of the file system is an EC protection mode.

第二方面,提供了一种文件系统,该文件系统管理的存储区域包括数据 区域和元数据区域;该文件系统包括:文件管理单元,数据管理单元和元数据管理单元;In a second aspect, a file system is provided, the storage area managed by the file system including data a zone and a metadata zone; the file system includes: a file management unit, a data management unit, and a metadata management unit;

该文件管理单元,用于接收写文件请求;根据该写文件请求,确定文件的待存储数据和该文件的元数据;确定该文件的待存储数据的多个数据分片;将该多个数据分片和该文件的元数据发送给该数据管理单元;将该文件的元数据发送给该元数据管理单元;The file management unit is configured to receive a write file request, determine, according to the write file request, data to be stored of the file and metadata of the file, and determine a plurality of data fragments of the data to be stored of the file; The fragment and the metadata of the file are sent to the data management unit; the metadata of the file is sent to the metadata management unit;

该数据管理单元,用于确定该多个数据分片中每个数据分片的本地元数据;将该多个数据分片中每个数据分片、该多个数据分片中每个数据分片的本地元数据和该文件的元数据存储到该数据区域;The data management unit is configured to determine local metadata of each of the plurality of data fragments; each of the plurality of data fragments, each of the plurality of data fragments The local metadata of the slice and the metadata of the file are stored in the data area;

该元数据管理单元,用于将该文件的元数据存储到该元数据区域。The metadata management unit is configured to store the metadata of the file into the metadata area.

本发明实施例的文件系统,除了在文件系统管理的元数据区域存储文件的元数据,还在文件系统管理的数据区域存储文件的元数据,这样,在元数据区域发生故障时,可以通过数据区域恢复元数据,从而能够有效地保护元数据。The file system of the embodiment of the present invention stores the metadata of the file in the data area managed by the file system, in addition to storing the metadata of the file in the metadata area managed by the file system, so that when the metadata area fails, the data can be passed. The area recovers metadata so that metadata can be effectively protected.

在一些可能的实现方式中,该数据管理单元具体用于,In some possible implementation manners, the data management unit is specifically configured to:

扩展该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域;Expanding a local metadata area in the data area corresponding to each of the plurality of data fragments;

将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的本地元数据区域中的扩展前的子区域;And storing the local metadata of each of the plurality of data fragments into the pre-expansion sub-area in the corresponding local metadata area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的本地元数据区域中的扩展子区域。The metadata of the file is stored into an extended sub-region in a local metadata region corresponding to each of the plurality of data segments.

在一些可能的实现方式中,该数据管理单元具体用于,In some possible implementation manners, the data management unit is specifically configured to:

将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的在该数据区域中的本地元数据区域中的第一子区域;And storing local metadata of each of the plurality of data fragments into a corresponding first sub-area in the local metadata area in the data area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域中的第二子区域。The metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.

在一些可能的实现方式中,在该元数据区域发生故障时, In some possible implementations, when a failure occurs in the metadata area,

该数据管理单元还用于读取该数据区域中的文件的元数据,将读取的文件的元数据发送给该元数据管理单元;The data management unit is further configured to read metadata of the file in the data area, and send metadata of the read file to the metadata management unit;

该元数据管理单元还用于根据该数据管理单元发送的文件的元数据,对该元数据区域进行恢复。The metadata management unit is further configured to recover the metadata area according to the metadata of the file sent by the data management unit.

在一些可能的实现方式中,该数据管理单元具体用于,读取该数据区域中每个数据分片对应的本地元数据区域中的文件的元数据,将读取的文件的元数据发送给该元数据管理单元;In some possible implementations, the data management unit is configured to: read metadata of a file in a local metadata area corresponding to each data segment in the data area, and send metadata of the read file to The metadata management unit;

该元数据管理单元具体用于,根据该数据管理单元发送的文件的元数据,恢复该元数据区域中的目录层级关系。The metadata management unit is specifically configured to restore the directory hierarchy relationship in the metadata area according to the metadata of the file sent by the data management unit.

在一些可能的实现方式中,该文件管理单元具体用于根据该文件系统的保护模式,确定该多个数据分片。In some possible implementations, the file management unit is specifically configured to determine the multiple data fragments according to the protection mode of the file system.

第三方面,提供了一种服务器系统,包括:In a third aspect, a server system is provided, comprising:

上述第二方面或第二方面的任一种可能的实现方式中的文件系统;以及a file system in any of the possible implementations of the second aspect or the second aspect above;

存储资源,该存储资源包括该文件系统管理的存储区域。A storage resource that includes a storage area managed by the file system.

第四方面,提供了一种服务器系统,包括:In a fourth aspect, a server system is provided, including:

存储资源,该存储资源包括文件系统管理的存储区域,该存储区域包括数据区域和元数据区域;a storage resource, where the storage resource includes a storage area managed by a file system, where the storage area includes a data area and a metadata area;

管理单元,用于执行上述第一方面或第一方面的任一种可能的实现方式中的方法。The management unit is configured to perform the method in any of the above possible implementation manners of the first aspect or the first aspect.

附图说明DRAWINGS

为了更清楚地说明本发明实施例的技术方案,下面将对本发明实施例中所需要使用的附图作简单地介绍,下面描述中的附图仅仅是本发明的一些实施例,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments of the present invention will be briefly described below. The drawings in the following description are only some embodiments of the present invention, and may also be based on these. The drawings obtain other figures.

图1是本发明实施例的技术方案可应用的服务器系统的示意图。FIG. 1 is a schematic diagram of a server system to which the technical solution of the embodiment of the present invention is applicable.

图2是本发明实施例的系统的架构图。2 is a block diagram of a system in accordance with an embodiment of the present invention.

图3是本发明实施例的管理文件的方法的示意性流程图。FIG. 3 is a schematic flowchart of a method for managing a file according to an embodiment of the present invention.

图4是本发明实施例的写文件的流程图。4 is a flow chart of a write file in accordance with an embodiment of the present invention.

图5是本发明实施例的恢复元数据的流程图。FIG. 5 is a flow chart of restoring metadata according to an embodiment of the present invention.

图6是本发明实施例的文件系统的示意性框图。Figure 6 is a schematic block diagram of a file system in accordance with an embodiment of the present invention.

图7是本发明一个实施例的服务器系统的示意性框图。 Figure 7 is a schematic block diagram of a server system in accordance with one embodiment of the present invention.

图8是本发明另一个实施例的服务器系统的示意性框图。Figure 8 is a schematic block diagram of a server system in accordance with another embodiment of the present invention.

具体实施方式detailed description

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明的一部分实施例,而不是全部实施例。基于本发明中的实施例所获得的所有其他实施例,都应属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained based on the embodiments of the present invention are intended to fall within the scope of the present invention.

本发明实施例的技术方案可以应用于各种文件系统,包括分布式文件系统和非分布式文件系统。The technical solutions of the embodiments of the present invention can be applied to various file systems, including a distributed file system and a non-distributed file system.

本发明实施例中,文件的元数据除了保存在元数据区域外,还在数据区域进行额外保存。数据区域和元数据区域可以属于在不同的故障域,例如位于不同的逻辑位置、或者位于不同的物理位置。因此,可以增强对文件的元数据的保护。例如把数据分片、这个数据分片的本地元数据以及文件的元数据,在同一个IO请求中下发到存储介质(例如硬盘、固态硬盘等)中。伴随着每个数据分片被存储到数据区域,可以有一份文件的元数据也被存储到数据区域。因此,数据分片的数量越多,元数据被备份的次数越多。In the embodiment of the present invention, the metadata of the file is additionally saved in the data area in addition to the metadata area. The data area and the metadata area may belong to different fault domains, such as at different logical locations, or at different physical locations. Therefore, the protection of the metadata of the file can be enhanced. For example, the data fragmentation, the local metadata of the data fragment, and the metadata of the file are sent to a storage medium (such as a hard disk, a solid state hard disk, etc.) in the same IO request. As each data slice is stored in the data area, metadata for a file can also be stored in the data area. Therefore, the more the number of data fragments, the more times the metadata is backed up.

由于文件的元数据是伴随数据分片一起下盘,因此,这样做法对系统性能影响非常小,又可以大幅度提高文件的元数据的可靠性。Since the metadata of the file is downloaded along with the data fragmentation, the method has a very small impact on system performance, and can greatly improve the reliability of the metadata of the file.

图1是可应用本发明实施例的技术方案的服务器系统的示意图。FIG. 1 is a schematic diagram of a server system to which the technical solution of the embodiment of the present invention is applicable.

如图1所示,服务器系统100可以包括至少一个服务器110,每个服务器110包括存储资源101,例如磁盘、固态硬盘或其他存储资源,提供存储空间。服务器110上还可以包括管理单元102,通过管理单元102实现文件系统的功能,提供文件系统的访问服务。As shown in FIG. 1, server system 100 can include at least one server 110, each server 110 including a storage resource 101, such as a disk, solid state drive, or other storage resource, to provide storage space. The server 110 may further include a management unit 102, and implements a function of the file system through the management unit 102 to provide an access service of the file system.

对于分布式文件系统,文件的数据可以按照分布式方式存储到任意服务器110的存储资源101中;对于非分布式文件系统,文件的数据存储到对应的服务器110的存储资源101中。For a distributed file system, the data of the file can be stored in the storage resource 101 of any server 110 in a distributed manner; for the non-distributed file system, the data of the file is stored in the storage resource 101 of the corresponding server 110.

每个服务器110可以是数据和/或元数据节点,即,可以只存储数据或元数据,也可以同时存储数据和元数据。所有服务器110的用于存储数据的区域构成文件系统管理的数据区域,所有服务器的用于存储元数据的区域构成文件系统管理的元数据区域。数据区域和元数据区域在逻辑上分开,在物理上可以位于相同的节点(如服务器),也可以位于不同的节点。 Each server 110 can be a data and/or metadata node, i.e., can store only data or metadata, as well as both data and metadata. The area of all servers 110 for storing data constitutes a data area managed by the file system, and the area of all servers for storing metadata constitutes a metadata area managed by the file system. The data area and the metadata area are logically separated, physically located on the same node (such as a server), or on different nodes.

应理解,在本发明的各种实施例中,各种管理单元可以是由处理器实施的功能模块,例如,可以是运行在处理器中的程序;各种管理单元也可以是硬件,例如可以是一个或多个处理器。各种存储资源可以是硬件,例如磁盘、固态硬盘或者易失性存储器;各种存储资源也可以是逻辑上的存储空间,例如对物理存储资源虚拟化生成,并且可以被管理单元所管理的逻辑存储空间。为了简洁,以下不再赘述。It should be understood that in various embodiments of the present invention, various management units may be functional modules implemented by a processor, for example, may be programs running in a processor; various management units may also be hardware, for example, Is one or more processors. The various storage resources may be hardware, such as a disk, a solid state hard disk, or a volatile memory; various storage resources may also be logical storage spaces, such as logic generated for virtualizing physical storage resources and managed by the management unit. storage. For the sake of brevity, the details are not described below.

图2示出了本发明实施例逻辑上的系统架构图。FIG. 2 shows a logical system architecture diagram of an embodiment of the present invention.

如图2所示,系统200包括元数据集群210和数据集群220。As shown in FIG. 2, system 200 includes a metadata cluster 210 and a data cluster 220.

元数据集群210和数据集群220可以在物理上分散在不同物理节点,也可以共用同一些物理节点,只是在逻辑上划分。The metadata cluster 210 and the data cluster 220 may be physically dispersed in different physical nodes, or may share the same physical nodes, but are logically divided.

元数据集群210包括元数据区域211,用于存储文件的元数据。元数据区域211可以位于一个或多个节点上。元数据集群210还包括一个或多个元数据管理单元212,用于管理元数据集群中文件的元数据。类似地,一个或多个元数据管理单元212也可以位于一个或多个节点上。The metadata cluster 210 includes a metadata area 211 for storing metadata of files. The metadata area 211 can be located on one or more nodes. The metadata cluster 210 also includes one or more metadata management units 212 for managing metadata for files in the metadata cluster. Similarly, one or more metadata management units 212 may also be located on one or more nodes.

数据集群220包括数据区域221,除了用于存储文件的数据和本地元数据外,还用于存储文件的元数据。本地元数据也可以称为本地文件系统元数据,包括数据分片的大小、创建时间等信息。The data cluster 220 includes a data area 221 for storing metadata of files in addition to data for storing files and local metadata. Local metadata can also be called local file system metadata, including information such as the size and creation time of data fragments.

元数据管理单元212是功能单元,可以位于单个服务器或者多个服务器组成的分布式文件系统。元数据管理单元212可以是软件,以分布式为例,可以由运行在多个服务器的分布式软件共同组成;也可以是硬件,例如由多个服务器的处理器共同组成,这些处理器可以运行所述分布式软件。元数据区域211接受元数据管理单元212的管理,并为元数据管理单元212读/写的数据提供存储空间。元数据区域211可以是物理存储介质,例如多个服务器的硬盘或者固态硬盘;也可以是逻辑上的存储空间,例如由多个服务器的存储器逻辑上组成的存储空间。The metadata management unit 212 is a functional unit and can be located in a distributed file system composed of a single server or a plurality of servers. The metadata management unit 212 may be software, for example, distributed, may be composed of distributed software running on multiple servers; or may be hardware, for example, a processor composed of multiple servers, which can run The distributed software. The metadata area 211 accepts the management of the metadata management unit 212 and provides a storage space for the data read/written by the metadata management unit 212. The metadata area 211 may be a physical storage medium such as a hard disk or a solid state hard disk of a plurality of servers; or may be a logical storage space such as a storage space logically composed of a plurality of servers.

数据集群220中的数据管理单元222和数据区域221,分别与元数据管理单元212和元数据区域211类似,此处不再赘述。The data management unit 222 and the data area 221 in the data cluster 220 are similar to the metadata management unit 212 and the metadata area 211, respectively, and are not described herein again.

可选地,本地元数据和文件的元数据可以一块存储于数据区域221中的本地元数据区域中。例如,可以扩展本地元数据区域,扩展出的区域称为本地元数据区域的扩展子区域,仍将本地元数据存储于原来的区域,称为扩展前的子区域,将文件的元数据存储于扩展子区域中。另外,若本地元数据区 域所提供的空间原本就足够存储本地元数据和文件的元数据,或者本地元数据区域已预先进行了扩展,则可将本地元数据和文件的元数据分别存储于本地元数据区域中的不同子区域中,即分别存储于本地元数据区域中的第一子区域和第二子区域,例如,第一子区域可以为本地元数据区域中前面的预定字节,第二子区域可以为本地元数据区域中后面的预定字节。Alternatively, the metadata of the local metadata and the file may be stored in one piece in the local metadata area in the data area 221. For example, the local metadata area can be extended, and the extended area is called an extended sub-area of the local metadata area, and the local metadata is still stored in the original area, which is called the sub-area before the expansion, and the metadata of the file is stored in Expand in the sub-area. In addition, if the local metadata area The space provided by the domain is sufficient to store the metadata of the local metadata and files, or the local metadata area has been extended in advance, and the metadata of the local metadata and the file can be stored separately in the local metadata area. In the sub-areas, that is, the first sub-area and the second sub-area respectively stored in the local metadata area, for example, the first sub-area may be a predetermined byte in the local metadata area, and the second sub-area may be The next predetermined byte in the local metadata area.

类似地,数据区域221可以位于一个或多个节点上。例如每个节点提供一部分存储空间,共同组成数据区域221。数据集群220还包括一个或多个数据管理单元222,用于管理数据集群中的文件的数据、本地元数据和文件的元数据。类似地,一个或多个数据管理单元222也可以位于一个或多个节点上。例如多个节点都运行数据管理软件,这些软件的整体组成数据管理单元222。Similarly, data area 221 can be located on one or more nodes. For example, each node provides a portion of storage space to collectively form a data area 221. The data cluster 220 also includes one or more data management units 222 for managing data for files in the data cluster, local metadata, and metadata for the files. Similarly, one or more data management units 222 can also be located on one or more nodes. For example, a plurality of nodes all run data management software, and the whole of these softwares constitutes a data management unit 222.

在一些实现方式中,元数据管理单元212和数据管理单元222为文件系统中的功能单元。例如,可以为图1中的管理单元102中的功能单元。应理解,文件系统中的功能单元还可以包括其他对文件进行管理的功能单元,本发明对此并不限定。In some implementations, metadata management unit 212 and data management unit 222 are functional units in a file system. For example, it may be a functional unit in the management unit 102 in FIG. It should be understood that the functional units in the file system may also include other functional units for managing the files, which are not limited by the present invention.

元数据区域211和数据区域221为文件系统管理的存储区域。The metadata area 211 and the data area 221 are storage areas managed by the file system.

文件系统和文件系统管理的存储区域可设置于服务器系统中,例如,图1中的服务器系统100。The storage area managed by the file system and the file system can be set in the server system, for example, the server system 100 in FIG.

图3示出了本发明实施例的管理文件的方法300的示意性流程图。FIG. 3 is a schematic flowchart of a method 300 for managing files according to an embodiment of the present invention.

在本发明实施例中,文件系统管理的存储区域包括数据区域和元数据区域,例如,图2中的数据区域221和元数据区域211。In the embodiment of the present invention, the storage area managed by the file system includes a data area and a metadata area, for example, the data area 221 and the metadata area 211 in FIG.

该方法300可以由服务器系统或者服务器系统中的文件系统执行,例如,可以由服务器系统或者文件系统中的管理单元执行,该管理单元又具体可以为一个或多个管理单元。为了便于描述,以下以服务器系统为例进行说明。The method 300 may be performed by a file system in a server system or a server system, for example, may be performed by a management unit in a server system or a file system, and the management unit may specifically be one or more management units. For convenience of description, the following describes a server system as an example.

310,接收写文件请求。310, receiving a write file request.

在写文件时,客户端向服务器系统发送写文件请求。该写文件请求可以包括文件的标识信息、待存储数据和访问地址的信息等。When writing a file, the client sends a write file request to the server system. The write file request may include identification information of the file, information of the data to be stored and the access address, and the like.

文件的待存储数据为文件的真实数据,即承载文件内容的数据。The data to be stored of the file is the real data of the file, that is, the data carrying the content of the file.

文件的标识信息表示所要写的是哪一个文件,例如,具体可以为目录名和文件名。The identification information of the file indicates which file is to be written, for example, the directory name and the file name.

访问地址的信息表示待存储数据所要写入的地址,例如,具体可以为首 地址和地址空间长度。The information of the access address indicates the address to be stored in the data to be stored, for example, specifically The length of the address and address space.

320,根据该写文件请求,确定文件的待存储数据和该文件的元数据。320. Determine, according to the write file request, data to be stored of the file and metadata of the file.

在接收到写文件请求后,服务器系统确定文件的待存储数据和该文件的元数据。文件的待存储数据可以直接携带在写文件请求中;文件的元数据可以根据写文件请求中的信息生成,相当于间接的携带在写文件请求中。该文件的元数据包括文件的目录结构、文件和目录的属性等信息。Upon receiving the write file request, the server system determines the data to be stored of the file and the metadata of the file. The data to be stored in the file can be directly carried in the write file request; the metadata of the file can be generated according to the information in the write file request, which is equivalent to being carried in the write file request indirectly. The metadata for this file includes information such as the directory structure of the file, the attributes of the files and directories, and so on.

330,确定该文件的待存储数据的多个数据分片。330. Determine a plurality of data fragments of the file to be stored.

可选地,可以根据文件系统的保护模式,确定该多个数据分片。Optionally, the plurality of data fragments may be determined according to a protection mode of the file system.

确定文件的待存储数据的数据分片,可以是从逻辑上把待存储数据划分成多个数据分片。例如,可以采用纠删码(erasure coding,EC)保护模式,将文件分为多个数据分片。Determining the data fragment of the data to be stored of the file may logically divide the data to be stored into a plurality of data fragments. For example, an erasure coding (EC) protection mode can be used to divide a file into multiple data fragments.

应理解,本发明对保护模式不做限定,也就是说,也可以采用其他保护模式。It should be understood that the present invention does not limit the protection mode, that is, other protection modes may also be employed.

可选地,上述步骤310-330具体可以由系统中的文件管理单元执行,然后,文件管理单元将该多个数据分片和该文件的元数据发送给系统中的数据管理单元。Optionally, the foregoing steps 310-330 may be specifically performed by a file management unit in the system, and then the file management unit sends the plurality of data fragments and the metadata of the file to the data management unit in the system.

340,确定该多个数据分片中每个数据分片的本地元数据。340. Determine local metadata of each of the plurality of data fragments.

在写文件时,需要处理两种数据,一种是文件的待存储的数据,另一种是文件的元数据。文件的待存储的数据分为数据分片后,将被存储到文件系统管理的数据区域。另外,每个数据分片还有对应的本地元数据,该本地元数据包括数据分片的大小、创建时间等信息。本地元数据也存储到数据区域,具体可以存储到数据区域中的本地元数据区域。When writing a file, you need to process two types of data, one is the data to be stored in the file, and the other is the metadata of the file. The data to be stored in the file is divided into data fragments and stored in the data area managed by the file system. In addition, each data fragment has corresponding local metadata, and the local metadata includes information such as the size and creation time of the data fragment. Local metadata is also stored in the data area, and can be stored locally in the local metadata area of the data area.

在获取到文件的多个数据分片后,服务器系统确定每个数据分片的本地元数据。具体而言,若之前没有相应的本地元数据,则根据新的数据分片生成本地元数据;若已有本地元数据,则根据新的数据分片修改本地元数据。After obtaining a plurality of data fragments of the file, the server system determines local metadata for each data slice. Specifically, if there is no corresponding local metadata before, local metadata is generated according to the new data fragment; if local metadata is already present, the local metadata is modified according to the new data fragment.

350,将该多个数据分片中每个数据分片、该多个数据分片中每个数据分片的本地元数据和该文件的元数据存储到该数据区域。350. Store, in each of the plurality of data fragments, local metadata of each of the plurality of data fragments and metadata of the file into the data area.

在该步骤中,每个数据分片、每个数据分片的本地元数据和文件的元数据一块存储到数据区域。In this step, each data slice, the local metadata of each data slice, and the metadata of the file are stored in a data area.

可选地,每个数据分片的本地元数据和文件的元数据可以一块存储到数据区域中的本地元数据区域。 Optionally, the local metadata of each data slice and the metadata of the file may be stored in one piece into a local metadata area in the data area.

具体而言,数据区域也可以分为两部分,一部分用于存储数据分片,可以称为数据分片区域;另一部分用于存储元数据,可以称为本地元数据区域。应理解,上述两种区域也可以采用其他表述,其具体的表述不应理解为对本发明的限制。Specifically, the data area may also be divided into two parts, one part for storing data fragments, which may be referred to as a data fragment area, and the other part for storing metadata, which may be referred to as a local metadata area. It is to be understood that the above-described two regions may be other embodiments, and the specific description is not to be construed as limiting the invention.

在本发明实施例中,将文件的元数据和每个数据分片的本地元数据一块存储到本地元数据区域。相比于只存储数据分片的本地元数据的情况,本发明实施例中的本地元数据区域要大。换句话说,本发明实施例的技术方案采用较大的本地元数据区域或者对本地元数据区域进行扩展。In the embodiment of the present invention, the metadata of the file and the local metadata of each data slice are stored in a local metadata area. The local metadata area in the embodiment of the present invention is large compared to the case of storing only local metadata of data fragments. In other words, the technical solution of the embodiment of the present invention uses a larger local metadata area or extends the local metadata area.

可选地,作为本发明的一个实施例,可以扩展该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域;Optionally, as an embodiment of the present invention, a local metadata area in the data area corresponding to each data fragment of the plurality of data fragments may be expanded;

将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的本地元数据区域中的扩展前的子区域;And storing the local metadata of each of the plurality of data fragments into the pre-expansion sub-area in the corresponding local metadata area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的本地元数据区域中的扩展子区域。The metadata of the file is stored into an extended sub-region in a local metadata region corresponding to each of the plurality of data segments.

具体而言,在本实施例中,对数据分片对应的本地元数据区域进行扩展,将文件的元数据存储到本地元数据区域中的扩展子区域中。也就是说,仍将本地元数据存储于原来的区域,将文件的元数据存储于扩展的子区域中。Specifically, in this embodiment, the local metadata area corresponding to the data fragment is expanded, and the metadata of the file is stored in the extended sub-area in the local metadata area. That is to say, the local metadata is still stored in the original area, and the metadata of the file is stored in the extended sub-area.

例如,可以将每个数据分片对应的本地元数据区域扩展512个字节,在扩展的区域中填入文件的元数据。For example, the local metadata area corresponding to each data slice can be extended by 512 bytes, and the metadata of the file is filled in the extended area.

应理解,上述的512个字节只是举例,不应理解为对本发明的限制,具体实现时可以根据文件的元数据的大小合理设置。It should be understood that the above 512 bytes are only examples, and should not be construed as limiting the present invention. The specific implementation may be reasonably set according to the size of the metadata of the file.

可选地,作为本发明的另一个实施例,可以将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;Optionally, as another embodiment of the present invention, each of the plurality of data fragments may be stored into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的在该数据区域中的本地元数据区域中的第一子区域;And storing local metadata of each of the plurality of data fragments into a corresponding first sub-area in the local metadata area in the data area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域中的第二子区域。The metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.

具体而言,在本实施例中,本地元数据区域可以预先设置地足够大,这样,可以直接将文件的元数据存储到本地元数据区域中的特定子区域。 Specifically, in the present embodiment, the local metadata area can be set large enough in advance, so that the metadata of the file can be directly stored to a specific sub-area in the local metadata area.

例如,可以将本地元数据区域分为两个子区域,前一个子区域存储本地元数据,后一个子区域存储文件的元数据。For example, the local metadata area can be divided into two sub-areas, the former sub-area stores local metadata, and the latter sub-area stores metadata of the file.

在具体实现时,在将数据分片、数据分片的本地元数据和文件的元数据下盘前,可先在缓存中对相应数据进行处理,然后一起下盘,即写入磁盘。这样,文件的元数据和本地元数据一块存储到本地元数据区域,不会增加多少I/O开销。In the specific implementation, before the data fragmentation, the local metadata of the data fragmentation and the metadata of the file are downloaded, the corresponding data may be processed in the cache, and then the disk is written down to the disk. In this way, the metadata of the file and the local metadata are stored in the local metadata area without increasing the I/O overhead.

可选地,上述步骤340和350具体可以由系统中的数据管理单元执行。然后,数据管理单元向文件管理单元发送写成功消息,该写成功消息指示数据分片和文件的元数据写成功。文件管理单元再向系统中的元数据管理单元发送文件的元数据,以请求该元数据管理单元更新文件的元数据。Optionally, the above steps 340 and 350 may be specifically performed by a data management unit in the system. Then, the data management unit sends a write success message to the file management unit, the write success message indicating that the data fragmentation and the metadata of the file are successfully written. The file management unit then transmits the metadata of the file to the metadata management unit in the system to request the metadata management unit to update the metadata of the file.

360,将该文件的元数据存储到该元数据区域。360, storing the metadata of the file into the metadata area.

服务器系统在文件系统管理的元数据区域更新文件的元数据。可选地,该步骤可以在数据区域写成功后执行,也可以与数据区域的写处理并行进行,本发明并不限定。The server system updates the metadata of the file in the metadata area of the file system management. Optionally, the step may be performed after the data area is successfully written, or may be performed in parallel with the write processing of the data area, which is not limited by the present invention.

可选地,上述步骤360具体可以由系统中的元数据管理单元执行。然后,元数据管理单元向文件管理单元发送写成功消息,该写成功消息指示文件的元数据写成功。文件管理单元再向客户端发送文件写成功消息。Optionally, the foregoing step 360 may be specifically performed by a metadata management unit in the system. Then, the metadata management unit sends a write success message to the file management unit, the write success message indicating that the metadata of the file is successfully written. The file management unit then sends a file write success message to the client.

本发明实施例的管理文件的方法,除了在文件系统管理的元数据区域存储文件的元数据,还在文件系统管理的数据区域存储文件的元数据,这样,在元数据区域发生故障时,可以通过数据区域恢复元数据,从而能够有效地保护元数据。The method for managing a file according to the embodiment of the present invention stores metadata of a file in a data area managed by the file system, in addition to storing metadata of the file in a metadata area managed by the file system, so that when a failure occurs in the metadata area, Metadata is restored through the data area, so that metadata can be effectively protected.

进一步地,本发明实施例的管理文件的方法,在数据区域,文件的元数据和数据分片的本地元数据一起存储到本地元数据区域,增加的I/O开销很少,因此,能够以很小的开销提高元数据的可靠性。Further, the method for managing a file in the embodiment of the present invention stores the metadata of the file and the local metadata of the data fragment into the local metadata area in the data area, and the added I/O overhead is small, so A small overhead increases the reliability of metadata.

以上描述了存储流程,下面对元数据恢复流程进行描述。The storage process is described above, and the metadata recovery process is described below.

可选地,如图3所示,该方法300还可以包括:Optionally, as shown in FIG. 3, the method 300 may further include:

370,在该元数据区域发生故障时,根据该数据区域中的文件的元数据,对该元数据区域进行恢复。370. When the metadata area fails, the metadata area is restored according to metadata of the file in the data area.

由于数据区域中也存储了文件的元数据,因此,在元数据区域发生故障时,可以通过扫描数据区域的元数据,对元数据区域的元数据进行恢复。Since the metadata of the file is also stored in the data area, when the metadata area fails, the metadata of the metadata area can be restored by scanning the metadata of the data area.

具体地,可以读取该数据区域中每个数据分片对应的本地元数据区域中 的文件的元数据;根据读取的文件的元数据,恢复该元数据区域中的目录层级关系。Specifically, the local metadata area corresponding to each data fragment in the data area can be read. The metadata of the file; based on the metadata of the read file, restore the directory hierarchy in the metadata area.

例如,在元数据区域发生故障时,可以扫描数据分片列表,按照数据分片列表读取每个数据分片本地元数据区域中的文件的元数据。例如,若文件的元数据存储在本地元数据区域的后512个字节中,则读取该512个字节中文件的元数据。For example, when a failure occurs in the metadata area, the data fragment list may be scanned, and the metadata of the files in each data fragment local metadata area is read according to the data fragmentation list. For example, if the metadata of the file is stored in the last 512 bytes of the local metadata area, the metadata of the file in the 512 bytes is read.

因为数据区域是完整可用的,扫描文件的元数据时只需要扫描数据区域中的本地元数据区域即可。Because the data area is fully available, you only need to scan the local metadata area in the data area when scanning the metadata for the file.

每得到一条文件的元数据,就在元数据区域的目录层级上添加一条记录。可选地,可以采用哈希(hash)表记录暂时没有串联起来的记录关系。等所有的记录收齐后,元数据区域的目录层级关系就建立完毕了。Each time you get the metadata for a file, a record is added to the directory hierarchy of the metadata area. Alternatively, a hash table may be used to record record relationships that are not currently concatenated. After all the records are collected, the directory hierarchy of the metadata area is established.

可选地,上述扫描过程可以由数据管理单元执行,并将读取到的文件的元数据发送给元数据管理单元;上述目录层级关系建立过程可以由元数据管理单元执行,并在建立完成后向文件管理单元发送恢复成功消息,该恢复成功消息指示元数据区域恢复完毕。Optionally, the scanning process may be performed by the data management unit, and the metadata of the read file is sent to the metadata management unit; the directory hierarchy relationship establishing process may be performed by the metadata management unit, and after the establishment is completed, A recovery success message is sent to the file management unit, indicating that the metadata area has been restored.

从上述技术方案可以看出,在本发明实施例的元数据区域恢复流程中,只需扫描数据区域中的特定区域,因此恢复流程比较简单。As can be seen from the above technical solution, in the metadata area recovery process of the embodiment of the present invention, only a specific area in the data area is scanned, so the recovery process is relatively simple.

下面结合图4和图5,从各管理单元的角度详细描述本发明实施例的技术方案。应理解,图4和图5中的各管理单元是从功能上划分的管理单元,在物理上它们可以设置于相同的节点上,也可以设置于不同的节点上。另外,图4和图5中的各管理单元的相互关系和功能,以及与系统中其他组件的关系等,可以参考前述各种实施例中的描述。The technical solution of the embodiment of the present invention is described in detail from the perspective of each management unit in conjunction with FIG. 4 and FIG. It should be understood that each management unit in FIG. 4 and FIG. 5 is a functionally divided management unit, which may be physically disposed on the same node or on different nodes. In addition, the mutual relationship and function of each management unit in FIG. 4 and FIG. 5, and the relationship with other components in the system, etc., can be referred to the description in the foregoing various embodiments.

图4为本发明一个实施例的写文件的流程图。4 is a flow chart of writing a file according to an embodiment of the present invention.

401,客户端发送写文件请求。401. The client sends a write file request.

客户端将写文件请求发送给服务器系统,具体发送给文件管理单元。该写文件请求可以包括文件的标识信息、待存储数据和访问地址的信息等。The client sends a write file request to the server system and sends it to the file management unit. The write file request may include identification information of the file, information of the data to be stored and the access address, and the like.

402,文件管理单元确定文件的待存储数据和该文件的元数据。402. The file management unit determines data to be stored of the file and metadata of the file.

该文件的元数据包括文件的目录结构、文件和目录的属性等信息。The metadata for this file includes information such as the directory structure of the file, the attributes of the files and directories, and so on.

403,文件管理单元确定该文件的待存储数据的多个数据分片。403. The file management unit determines a plurality of data fragments of the file to be stored.

可选地,可以根据文件系统的保护模式,例如EC保护模式,将文件分为多个数据分片。 Optionally, the file may be divided into multiple data fragments according to a protection mode of the file system, such as an EC protection mode.

404,文件管理单元将该多个数据分片和该文件的元数据发送给数据管理单元。404. The file management unit sends the plurality of data fragments and the metadata of the file to the data management unit.

405,数据管理单元将接收到的数据写入缓存。405. The data management unit writes the received data into the cache.

即,将数据分片和文件的元数据写入缓存。That is, the data fragment and the metadata of the file are written to the cache.

406,数据管理单元确定本地元数据。406. The data management unit determines local metadata.

该本地元数据包括数据分片的大小、创建时间等信息。数据管理单元根据该多个数据分片,确定每个数据分片的本地元数据。The local metadata includes information such as the size of the data slice, the creation time, and the like. The data management unit determines local metadata of each data slice according to the plurality of data fragments.

407,数据管理单元在本地元数据区域填入文件的元数据。407. The data management unit fills in the metadata of the file in the local metadata area.

例如,数据管理单元将每个数据分片的本地元数据区域扩展512个字节,在扩展的区域中填入文件的元数据;或者,数据管理单元在预先扩展的本地元数据区域的后512个字节中填入文件的元数据。For example, the data management unit expands the local metadata area of each data slice by 512 bytes, and fills in the metadata of the file in the extended area; or, the data management unit is in the back 512 of the pre-expanded local metadata area. Fill in the metadata of the file in bytes.

408,数据管理单元将数据分片、数据分片的本地元数据和文件的元数据一起下盘。408. The data management unit discards the data fragmentation, the local metadata of the data fragment, and the metadata of the file.

这样,数据管理单元将数据分片、数据分片的本地元数据和文件的元数据一起存储到了数据区域。In this way, the data management unit stores the data fragmentation, the local metadata of the data fragmentation, and the metadata of the file together in the data area.

409,数据管理单元回应文件管理单元数据分片和文件的元数据写成功。409. The data management unit responds to the file management unit data fragmentation and the metadata of the file is successfully written.

410,文件管理单元向元数据管理单元发请求,请求更新文件的元数据。410. The file management unit sends a request to the metadata management unit to request metadata of the updated file.

411,元数据管理单元将文件的元数据存储到元数据区域。411. The metadata management unit stores the metadata of the file into the metadata area.

412,元数据管理单元向文件管理单元返回元数据写成功消息。412. The metadata management unit returns a metadata write success message to the file management unit.

413,文件管理单元向客户端返回文件写成功消息。413. The file management unit returns a file write success message to the client.

图5为本发明一个实施例的恢复元数据的流程图。FIG. 5 is a flow chart of restoring metadata according to an embodiment of the present invention.

501,数据管理单元扫描数据分片列表。501. The data management unit scans the data fragment list.

在元数据区域发生故障时,根据数据区域的元数据,对元数据区域的元数据进行恢复。数据管理单元扫描数据分片列表,对于每一个数据分片,进行下述操作。When a failure occurs in the metadata area, the metadata of the metadata area is restored according to the metadata of the data area. The data management unit scans the data slice list, and for each data slice, the following operations are performed.

502,数据管理单元按照数据分片列表读取每个分片本地元数据区域中的文件的元数据。502. The data management unit reads the metadata of the file in each of the fragment local metadata areas according to the data fragmentation list.

例如,若文件的元数据存储在本地元数据区域的后512个字节中,则读取该512个字节中文件的元数据。For example, if the metadata of the file is stored in the last 512 bytes of the local metadata area, the metadata of the file in the 512 bytes is read.

因为数据区域是完整可用的,扫描文件的元数据时只需要扫描数据区域中的本地元数据区域即可。 Because the data area is fully available, you only need to scan the local metadata area in the data area when scanning the metadata for the file.

503,数据管理单元将读取的文件的元数据发送给元数据管理单元。503. The data management unit sends the metadata of the read file to the metadata management unit.

504,元数据管理单元根据接收到的文件的元数据恢复目录层级关系。504. The metadata management unit restores the directory hierarchy relationship according to the metadata of the received file.

元数据管理单元每收到一条文件的元数据,就在元数据区域的目录层级上添加一条记录。可选地,可以采用hash表记录暂时没有串联起来的记录关系。等所有的记录收齐后,元数据区域的目录层级关系就建立完毕了。Each time the metadata management unit receives the metadata of a file, it adds a record at the directory level of the metadata area. Optionally, a hash table may be used to record record relationships that are not currently connected in series. After all the records are collected, the directory hierarchy of the metadata area is established.

505,元数据管理单元向文件管理单元发送恢复成功消息。505. The metadata management unit sends a recovery success message to the file management unit.

元数据区域恢复完毕后,元数据管理单元通知文件管理单元,元数据区域已经恢复,从而文件服务恢复提供。After the metadata area is restored, the metadata management unit notifies the file management unit that the metadata area has been restored, so that the file service is restored.

应理解,在本发明的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。It should be understood that, in various embodiments of the present invention, the size of the sequence numbers of the above processes does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not be taken to the embodiments of the present invention. The implementation process constitutes any limitation.

还应理解,本发明实施例中的具体的例子只是为了帮助本领域技术人员更好地理解本发明实施例,而非限制本发明实施例的范围。It should be understood that the specific examples of the embodiments of the present invention are only to be understood by those skilled in the art.

上文中详细描述了根据本发明实施例的管理文件的方法,下面将描述根据本发明实施例的文件系统和服务器系统。The method of managing files according to an embodiment of the present invention is described in detail above, and a file system and a server system according to an embodiment of the present invention will be described below.

图6示出了本发明实施例的文件系统600的示意性框图。FIG. 6 shows a schematic block diagram of a file system 600 in accordance with an embodiment of the present invention.

该文件系统600管理的存储区域包括数据区域和元数据区域。如图6所示,该文件系统600可以包括:文件管理单元610,数据管理单元620和元数据管理单元630。The storage area managed by the file system 600 includes a data area and a metadata area. As shown in FIG. 6, the file system 600 can include a file management unit 610, a data management unit 620, and a metadata management unit 630.

该文件管理单元610,用于接收写文件请求;根据该写文件请求,确定文件的待存储数据和该文件的元数据;确定该文件的待存储数据的多个数据分片;将该多个数据分片和该文件的元数据发送给该数据管理单元620;将该文件的元数据发送给该元数据管理单元630。The file management unit 610 is configured to receive a write file request, determine, according to the write file request, data to be stored of the file and metadata of the file, and determine a plurality of data fragments of the file to be stored; The data fragment and the metadata of the file are sent to the data management unit 620; the metadata of the file is sent to the metadata management unit 630.

该数据管理单元620,用于确定该多个数据分片中每个数据分片的本地元数据;将该多个数据分片中每个数据分片、该多个数据分片中每个数据分片的本地元数据和该文件的元数据存储到该数据区域。The data management unit 620 is configured to determine local metadata of each of the plurality of data fragments, and slice each of the plurality of data fragments, and each of the plurality of data fragments The local metadata of the slice and the metadata of the file are stored in the data area.

该元数据管理单元630,用于将该文件的元数据存储到该元数据区域。The metadata management unit 630 is configured to store the metadata of the file into the metadata area.

本发明实施例的文件系统,除了在文件系统管理的元数据区域存储文件的元数据,还在文件系统管理的数据区域存储文件的元数据,这样,在元数据区域发生故障时,可以通过数据区域恢复元数据,从而能够有效地保护元数据。 The file system of the embodiment of the present invention stores the metadata of the file in the data area managed by the file system, in addition to storing the metadata of the file in the metadata area managed by the file system, so that when the metadata area fails, the data can be passed. The area recovers metadata so that metadata can be effectively protected.

可选地,在本发明一个实施例中,该数据管理单元620具体用于,Optionally, in an embodiment of the present invention, the data management unit 620 is specifically configured to:

扩展该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域;Expanding a local metadata area in the data area corresponding to each of the plurality of data fragments;

将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的本地元数据区域中的扩展前的子区域;And storing the local metadata of each of the plurality of data fragments into the pre-expansion sub-area in the corresponding local metadata area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的本地元数据区域中的扩展子区域。The metadata of the file is stored into an extended sub-region in a local metadata region corresponding to each of the plurality of data segments.

可选地,在本发明一个实施例中,该数据管理单元620具体用于,Optionally, in an embodiment of the present invention, the data management unit 620 is specifically configured to:

将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的在该数据区域中的本地元数据区域中的第一子区域;And storing local metadata of each of the plurality of data fragments into a corresponding first sub-area in the local metadata area in the data area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域中的第二子区域。The metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.

可选地,在本发明一个实施例中,在该元数据区域发生故障时,Optionally, in an embodiment of the present invention, when the metadata area fails,

该数据管理单元620还用于读取该数据区域中的文件的元数据,将读取的文件的元数据发送给该元数据管理单元630;The data management unit 620 is further configured to read the metadata of the file in the data area, and send the metadata of the read file to the metadata management unit 630;

该元数据管理单元630还用于根据该数据管理单元620发送的文件的元数据,对该元数据区域进行恢复。The metadata management unit 630 is further configured to recover the metadata area according to the metadata of the file sent by the data management unit 620.

可选地,在本发明一个实施例中,该数据管理单元620具体用于,读取该数据区域中每个数据分片对应的本地元数据区域中的文件的元数据,将读取的文件的元数据发送给该元数据管理单元630;Optionally, in an embodiment of the present invention, the data management unit 620 is specifically configured to: read metadata of a file in a local metadata area corresponding to each data fragment in the data area, and read the file. Metadata is sent to the metadata management unit 630;

该元数据管理单元630具体用于,根据该数据管理单元620发送的文件的元数据,恢复该元数据区域中的目录层级关系。The metadata management unit 630 is specifically configured to restore the directory hierarchy relationship in the metadata area according to the metadata of the file sent by the data management unit 620.

可选地,在本发明一个实施例中,该文件管理单元610具体用于根据该文件系统的保护模式,确定该多个数据分片。Optionally, in an embodiment of the present invention, the file management unit 610 is specifically configured to determine the multiple data fragments according to the protection mode of the file system.

本发明实施例的文件系统600可以执行本发明实施例的管理文件的方法,并且文件系统600中的各个单元的上述和其它操作和/或功能分别为了实现前述各个方法的相应流程,可以参考前述各种实施例中的描述,为了简洁, 在此不再赘述。The file system 600 of the embodiment of the present invention may perform the method for managing files according to the embodiment of the present invention, and the foregoing and other operations and/or functions of the respective units in the file system 600 may be referred to the foregoing in order to implement the corresponding processes of the foregoing respective methods. The description in the various embodiments, for the sake of brevity, I will not repeat them here.

图7示出了本发明一个实施例的服务器系统700的示意性框图。如图7所示,该服务器系统700可以包括:FIG. 7 shows a schematic block diagram of a server system 700 in accordance with one embodiment of the present invention. As shown in FIG. 7, the server system 700 can include:

前述本发明实施例的文件系统600;以及The file system 600 of the foregoing embodiment of the present invention;

存储资源710,该存储资源710包括该文件系统600管理的存储区域。A storage resource 710 includes a storage area managed by the file system 600.

关于本发明实施例的文件系统600的详细描述,可以参考前述实施例,为了简洁,在此不再赘述。For a detailed description of the file system 600 of the embodiment of the present invention, reference may be made to the foregoing embodiments, and details are not described herein for brevity.

图8示出了本发明另一个实施例的服务器系统800的示意性框图。如图8所示,该服务器系统800可以包括:FIG. 8 shows a schematic block diagram of a server system 800 in accordance with another embodiment of the present invention. As shown in FIG. 8, the server system 800 can include:

存储资源810,该存储资源810包括文件系统管理的存储区域,该存储区域包括数据区域和元数据区域;a storage resource 810, which includes a storage area managed by a file system, the storage area including a data area and a metadata area;

管理单元820,用于:The management unit 820 is configured to:

接收写文件请求;Receiving a write file request;

根据该写文件请求,确定文件的待存储数据和该文件的元数据;Determining data to be stored of the file and metadata of the file according to the write file request;

确定该文件的待存储数据的多个数据分片;Determining a plurality of data segments of the file to be stored;

确定该多个数据分片中每个数据分片的本地元数据;Determining local metadata of each of the plurality of data segments;

将该多个数据分片中每个数据分片、该多个数据分片中每个数据分片的本地元数据和该文件的元数据存储到该数据区域;Each of the plurality of data fragments, the local metadata of each of the plurality of data fragments, and the metadata of the file are stored in the data area;

将该文件的元数据存储到该元数据区域。The metadata for the file is stored in the metadata area.

本发明实施例的服务器系统,除了在文件系统管理的元数据区域存储文件的元数据,还在文件系统管理的数据区域存储文件的元数据,这样,在元数据区域发生故障时,可以通过数据区域恢复元数据,从而能够有效地保护元数据。In the server system of the embodiment of the present invention, in addition to storing the metadata of the file in the metadata area managed by the file system, the metadata of the file is also stored in the data area managed by the file system, so that when the metadata area fails, the data can be passed. The area recovers metadata so that metadata can be effectively protected.

可选地,在本发明一个实施例中,该管理单元820具体用于,Optionally, in an embodiment of the present invention, the management unit 820 is specifically configured to:

扩展该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域;Expanding a local metadata area in the data area corresponding to each of the plurality of data fragments;

将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的本地元数据区域中的扩展前的子区域;And storing the local metadata of each of the plurality of data fragments into the pre-expansion sub-area in the corresponding local metadata area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的本地 元数据区域中的扩展子区域。Storing the metadata of the file to a local area corresponding to each of the plurality of data fragments An extended sub-area in the metadata area.

可选地,在本发明一个实施例中,该管理单元820具体用于,Optionally, in an embodiment of the present invention, the management unit 820 is specifically configured to:

将该多个数据分片中每个数据分片存储到对应的在该数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area;

将该多个数据分片中每个数据分片的本地元数据存储到对应的在该数据区域中的本地元数据区域中的第一子区域;And storing local metadata of each of the plurality of data fragments into a corresponding first sub-area in the local metadata area in the data area;

将该文件的元数据存储到该多个数据分片中每个数据分片对应的在该数据区域中的本地元数据区域中的第二子区域。The metadata of the file is stored to a second sub-region in the local metadata region of the data region corresponding to each of the plurality of data segments.

可选地,在本发明一个实施例中,该管理单元820还用于,Optionally, in an embodiment of the present invention, the management unit 820 is further configured to:

在该元数据区域发生故障时,根据该数据区域中的文件的元数据,对该元数据区域进行恢复。When the metadata area fails, the metadata area is restored according to the metadata of the file in the data area.

可选地,在本发明一个实施例中,该管理单元820具体用于,Optionally, in an embodiment of the present invention, the management unit 820 is specifically configured to:

读取该数据区域中每个数据分片对应的本地元数据区域中的文件的元数据;Reading metadata of a file in a local metadata area corresponding to each data slice in the data area;

根据读取的文件的元数据,恢复该元数据区域中的目录层级关系。The directory hierarchy relationship in the metadata area is restored according to the metadata of the read file.

可选地,在本发明一个实施例中,该管理单元820具体用于,Optionally, in an embodiment of the present invention, the management unit 820 is specifically configured to:

根据该文件系统的保护模式,确定该多个数据分片。The plurality of data fragments are determined according to the protection mode of the file system.

本发明实施例的服务器系统800中的管理单元820可以执行前述方法实施例中的各个流程,相应的具体描述可参考前述各实施例,为了简洁,在此不再赘述。The management unit 820 in the server system 800 of the embodiment of the present invention may perform the various processes in the foregoing method embodiments. For the specific description, reference may be made to the foregoing embodiments, and details are not described herein for brevity.

应理解,在本发明实施例中,术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系。例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。It should be understood that in the embodiment of the present invention, the term "and/or" is merely an association relationship describing an associated object, indicating that there may be three relationships. For example, A and/or B may indicate that A exists separately, and A and B exist simultaneously, and B cases exist alone. In addition, the character "/" in this article generally indicates that the contextual object is an "or" relationship.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。 Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both, for clarity of hardware and software. Interchangeability, the composition and steps of the various examples have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods for implementing the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present invention.

所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, 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. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, or an electrical, mechanical or other form of connection.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本发明实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as 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 embodiments of the present invention.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, 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 above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention contributes in essence or to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of instructions are included 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 mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。 The above is only the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any equivalent person can be easily conceived within the technical scope of the present invention by any person skilled in the art. Modifications or substitutions are intended to be included within the scope of the invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims (19)

一种文件系统中管理文件的方法,其特征在于,所述文件系统管理的存储区域包括数据区域和元数据区域;所述方法包括:A method for managing a file in a file system, wherein the storage area managed by the file system includes a data area and a metadata area; and the method includes: 接收写文件请求;Receiving a write file request; 根据所述写文件请求,确定文件的待存储数据和所述文件的元数据;Determining data to be stored of the file and metadata of the file according to the write file request; 确定所述文件的待存储数据的多个数据分片;Determining a plurality of data segments of the file to be stored; 确定所述多个数据分片中每个数据分片的本地元数据;Determining local metadata of each of the plurality of data segments; 将所述多个数据分片中每个数据分片、所述多个数据分片中每个数据分片的本地元数据和所述文件的元数据存储到所述数据区域;And storing, in the data area, each data fragment of the plurality of data fragments, local metadata of each of the plurality of data fragments, and metadata of the file; 将所述文件的元数据存储到所述元数据区域。Metadata of the file is stored to the metadata area. 根据权利要求1所述的方法,其特征在于,所述将所述多个数据分片中每个数据分片、所述多个数据分片中每个数据分片的本地元数据和所述文件的元数据存储到所述数据区域,包括:The method according to claim 1, wherein said each of said plurality of data segments is sliced, said local metadata of each of said plurality of data segments, and said The metadata of the file is stored in the data area, including: 扩展所述多个数据分片中每个数据分片对应的在所述数据区域中的本地元数据区域;Expanding a local metadata area in the data area corresponding to each of the plurality of data fragments; 将所述多个数据分片中每个数据分片存储到对应的在所述数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area; 将所述多个数据分片中每个数据分片的本地元数据存储到对应的本地元数据区域中的扩展前的子区域;And storing local metadata of each of the plurality of data fragments into an extended pre-region in the corresponding local metadata area; 将所述文件的元数据存储到所述多个数据分片中每个数据分片对应的本地元数据区域中的扩展子区域。Metadata of the file is stored to an extended sub-region in a local metadata region corresponding to each of the plurality of data segments. 根据权利要求1所述的方法,其特征在于,所述将所述多个数据分片中每个数据分片、所述多个数据分片中每个数据分片的本地元数据和所述文件的元数据存储到所述数据区域,包括:The method according to claim 1, wherein said each of said plurality of data segments is sliced, said local metadata of each of said plurality of data segments, and said The metadata of the file is stored in the data area, including: 将所述多个数据分片中每个数据分片存储到对应的在所述数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area; 将所述多个数据分片中每个数据分片的本地元数据存储到对应的在所述数据区域中的本地元数据区域中的第一子区域;Storing local metadata of each of the plurality of data fragments into a corresponding first sub-area in a local metadata area in the data area; 将所述文件的元数据存储到所述多个数据分片中每个数据分片对应的在所述数据区域中的本地元数据区域中的第二子区域。Metadata of the file is stored to a second sub-region in a local metadata region in the data region corresponding to each of the plurality of data segments. 根据权利要求1至3中任一项所述的方法,其特征在于,所述方法 还包括:Method according to any one of claims 1 to 3, characterized in that the method Also includes: 在所述元数据区域发生故障时,根据所述数据区域中的文件的元数据,对所述元数据区域进行恢复。When the metadata area fails, the metadata area is restored according to metadata of files in the data area. 根据权利要求4所述的方法,其特征在于,所述根据所述数据区域中的文件的元数据,对所述元数据区域进行恢复,包括:The method according to claim 4, wherein the recovering the metadata area according to the metadata of the file in the data area comprises: 读取所述数据区域中每个数据分片对应的本地元数据区域中的文件的元数据;Reading metadata of a file in a local metadata area corresponding to each data slice in the data area; 根据读取的文件的元数据,恢复所述元数据区域中的目录层级关系。The directory hierarchy relationship in the metadata area is restored according to the metadata of the read file. 根据权利要求1至5中任一项所述的方法,其特征在于,所述确定所述文件的待存储数据的多个数据分片,包括:The method according to any one of claims 1 to 5, wherein the determining a plurality of data fragments of the file to be stored of the file comprises: 根据所述文件系统的保护模式,确定所述多个数据分片。The plurality of data fragments are determined according to a protection mode of the file system. 一种文件系统,其特征在于,所述文件系统管理的存储区域包括数据区域和元数据区域;所述文件系统包括:文件管理单元,数据管理单元和元数据管理单元;A file system, wherein the storage area managed by the file system comprises a data area and a metadata area; the file system comprises: a file management unit, a data management unit and a metadata management unit; 所述文件管理单元,用于接收写文件请求;根据所述写文件请求,确定文件的待存储数据和所述文件的元数据;确定所述文件的待存储数据的多个数据分片;将所述多个数据分片和所述文件的元数据发送给所述数据管理单元;将所述文件的元数据发送给所述元数据管理单元;The file management unit is configured to receive a write file request, determine, according to the write file request, data to be stored of the file and metadata of the file, and determine a plurality of data fragments of the file to be stored; Transmitting the plurality of data fragments and the metadata of the file to the data management unit; and transmitting the metadata of the file to the metadata management unit; 所述数据管理单元,用于确定所述多个数据分片中每个数据分片的本地元数据;将所述多个数据分片中每个数据分片、所述多个数据分片中每个数据分片的本地元数据和所述文件的元数据存储到所述数据区域;The data management unit is configured to determine local metadata of each of the plurality of data fragments; and slice each of the plurality of data fragments into the plurality of data fragments Local metadata of each data slice and metadata of the file are stored to the data area; 所述元数据管理单元,用于将所述文件的元数据存储到所述元数据区域。The metadata management unit is configured to store metadata of the file to the metadata area. 根据权利要求7所述的文件系统,其特征在于,所述数据管理单元具体用于,The file system according to claim 7, wherein said data management unit is specifically configured to: 扩展所述多个数据分片中每个数据分片对应的在所述数据区域中的本地元数据区域;Expanding a local metadata area in the data area corresponding to each of the plurality of data fragments; 将所述多个数据分片中每个数据分片存储到对应的在所述数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area; 将所述多个数据分片中每个数据分片的本地元数据存储到对应的本地元数据区域中的扩展前的子区域; And storing local metadata of each of the plurality of data fragments into an extended pre-region in the corresponding local metadata area; 将所述文件的元数据存储到所述多个数据分片中每个数据分片对应的本地元数据区域中的扩展子区域。Metadata of the file is stored to an extended sub-region in a local metadata region corresponding to each of the plurality of data segments. 根据权利要求7所述的文件系统,其特征在于,所述数据管理单元具体用于,The file system according to claim 7, wherein said data management unit is specifically configured to: 将所述多个数据分片中每个数据分片存储到对应的在所述数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area; 将所述多个数据分片中每个数据分片的本地元数据存储到对应的在所述数据区域中的本地元数据区域中的第一子区域;Storing local metadata of each of the plurality of data fragments into a corresponding first sub-area in a local metadata area in the data area; 将所述文件的元数据存储到所述多个数据分片中每个数据分片对应的在所述数据区域中的本地元数据区域中的第二子区域。Metadata of the file is stored to a second sub-region in a local metadata region in the data region corresponding to each of the plurality of data segments. 根据权利要求7至9中任一项所述的文件系统,其特征在于,在所述元数据区域发生故障时,A file system according to any one of claims 7 to 9, wherein when the metadata area fails, 所述数据管理单元还用于读取所述数据区域中的文件的元数据,将读取的文件的元数据发送给所述元数据管理单元;The data management unit is further configured to read metadata of a file in the data area, and send metadata of the read file to the metadata management unit; 所述元数据管理单元还用于根据所述数据管理单元发送的文件的元数据,对所述元数据区域进行恢复。The metadata management unit is further configured to recover the metadata area according to metadata of the file sent by the data management unit. 根据权利要求10所述的文件系统,其特征在于,所述数据管理单元具体用于,读取所述数据区域中每个数据分片对应的本地元数据区域中的文件的元数据,将读取的文件的元数据发送给所述元数据管理单元;The file system according to claim 10, wherein the data management unit is configured to read metadata of a file in a local metadata area corresponding to each data slice in the data area, and read the data. The metadata of the fetched file is sent to the metadata management unit; 所述元数据管理单元具体用于,根据所述数据管理单元发送的文件的元数据,恢复所述元数据区域中的目录层级关系。The metadata management unit is specifically configured to restore a directory hierarchy relationship in the metadata area according to the metadata of the file sent by the data management unit. 根据权利要求7至11中任一项所述的文件系统,其特征在于,所述文件管理单元具体用于根据所述文件系统的保护模式,确定所述多个数据分片。The file system according to any one of claims 7 to 11, wherein the file management unit is specifically configured to determine the plurality of data fragments according to a protection mode of the file system. 一种服务器系统,其特征在于,包括:A server system, comprising: 根据权利要求7至12中任一项所述的文件系统;以及A file system according to any one of claims 7 to 12; 存储资源,所述存储资源包括所述文件系统管理的存储区域。A storage resource, the storage resource including a storage area managed by the file system. 一种服务器系统,其特征在于,包括:A server system, comprising: 存储资源,所述存储资源包括文件系统管理的存储区域,所述存储区域包括数据区域和元数据区域;a storage resource, where the storage resource includes a storage area managed by a file system, where the storage area includes a data area and a metadata area; 管理单元,用于: Management unit for: 接收写文件请求;Receiving a write file request; 根据所述写文件请求,确定文件的待存储数据和所述文件的元数据;Determining data to be stored of the file and metadata of the file according to the write file request; 确定所述文件的待存储数据的多个数据分片;Determining a plurality of data segments of the file to be stored; 确定所述多个数据分片中每个数据分片的本地元数据;Determining local metadata of each of the plurality of data segments; 将所述多个数据分片中每个数据分片、所述多个数据分片中每个数据分片的本地元数据和所述文件的元数据存储到所述数据区域;And storing, in the data area, each data fragment of the plurality of data fragments, local metadata of each of the plurality of data fragments, and metadata of the file; 将所述文件的元数据存储到所述元数据区域。Metadata of the file is stored to the metadata area. 根据权利要求14所述的服务器系统,其特征在于,所述管理单元具体用于,The server system according to claim 14, wherein the management unit is specifically configured to: 扩展所述多个数据分片中每个数据分片对应的在所述数据区域中的本地元数据区域;Expanding a local metadata area in the data area corresponding to each of the plurality of data fragments; 将所述多个数据分片中每个数据分片存储到对应的在所述数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area; 将所述多个数据分片中每个数据分片的本地元数据存储到对应的本地元数据区域中的扩展前的子区域;And storing local metadata of each of the plurality of data fragments into an extended pre-region in the corresponding local metadata area; 将所述文件的元数据存储到所述多个数据分片中每个数据分片对应的本地元数据区域中的扩展子区域。Metadata of the file is stored to an extended sub-region in a local metadata region corresponding to each of the plurality of data segments. 根据权利要求14所述的服务器系统,其特征在于,所述管理单元具体用于,The server system according to claim 14, wherein the management unit is specifically configured to: 将所述多个数据分片中每个数据分片存储到对应的在所述数据区域中的数据分片区域;And storing each of the plurality of data fragments into a corresponding data fragment area in the data area; 将所述多个数据分片中每个数据分片的本地元数据存储到对应的在所述数据区域中的本地元数据区域中的第一子区域;Storing local metadata of each of the plurality of data fragments into a corresponding first sub-area in a local metadata area in the data area; 将所述文件的元数据存储到所述多个数据分片中每个数据分片对应的在所述数据区域中的本地元数据区域中的第二子区域。Metadata of the file is stored to a second sub-region in a local metadata region in the data region corresponding to each of the plurality of data segments. 根据权利要求14至16中任一项所述的服务器系统,其特征在于,所述管理单元还用于,The server system according to any one of claims 14 to 16, wherein the management unit is further configured to: 在所述元数据区域发生故障时,根据所述数据区域中的文件的元数据,对所述元数据区域进行恢复。When the metadata area fails, the metadata area is restored according to metadata of files in the data area. 根据权利要求17所述的服务器系统,其特征在于,所述管理单元具体用于, The server system according to claim 17, wherein said management unit is specifically configured to: 读取所述数据区域中每个数据分片对应的本地元数据区域中的文件的元数据;Reading metadata of a file in a local metadata area corresponding to each data slice in the data area; 根据读取的文件的元数据,恢复所述元数据区域中的目录层级关系。The directory hierarchy relationship in the metadata area is restored according to the metadata of the read file. 根据权利要求14至18中任一项所述的服务器系统,其特征在于,所述管理单元具体用于,The server system according to any one of claims 14 to 18, wherein the management unit is specifically configured to: 根据所述文件系统的保护模式,确定所述多个数据分片。 The plurality of data fragments are determined according to a protection mode of the file system.
PCT/CN2016/104385 2016-11-02 2016-11-02 File management method, file system, and server system Ceased WO2018081960A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201680003120.4A CN108271420B (en) 2016-11-02 2016-11-02 Method, file system and server system for managing files
PCT/CN2016/104385 WO2018081960A1 (en) 2016-11-02 2016-11-02 File management method, file system, and server system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/104385 WO2018081960A1 (en) 2016-11-02 2016-11-02 File management method, file system, and server system

Publications (1)

Publication Number Publication Date
WO2018081960A1 true WO2018081960A1 (en) 2018-05-11

Family

ID=62075382

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/104385 Ceased WO2018081960A1 (en) 2016-11-02 2016-11-02 File management method, file system, and server system

Country Status (2)

Country Link
CN (1) CN108271420B (en)
WO (1) WO2018081960A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113312355A (en) * 2021-06-15 2021-08-27 北京沃东天骏信息技术有限公司 Data management method and device

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113986944B (en) * 2021-12-29 2022-03-25 天地伟业技术有限公司 Method, system and electronic device for writing fragmented data
CN114328421B (en) * 2022-03-17 2022-06-10 联想凌拓科技有限公司 Metadata service architecture management method, computer system, electronic device and medium
CN118069432B (en) * 2024-04-19 2024-07-05 济南浪潮数据技术有限公司 Method, device, equipment and storage medium for snapshot rollback of distributed block storage volume

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006008593A1 (en) * 2004-07-14 2006-01-26 Nokia Corporation Grouping of session objects
CN101656094A (en) * 2009-09-25 2010-02-24 杭州华三通信技术有限公司 Data storage method and storage device
CN102024059A (en) * 2010-12-31 2011-04-20 成都市华为赛门铁克科技有限公司 Method and device for protecting redundant array of independent disk in file system
CN102088389A (en) * 2009-12-02 2011-06-08 中兴通讯股份有限公司 Distributed content access scheduling device and content reading method
CN104166524A (en) * 2014-08-19 2014-11-26 浪潮电子信息产业股份有限公司 Processing method of metadata and data
CN105159607A (en) * 2015-08-28 2015-12-16 浪潮(北京)电子信息产业有限公司 Discrete storage based high-speed writing method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8868882B2 (en) * 2011-06-08 2014-10-21 Microsoft Corporation Storage architecture for backup application
CN103019626B (en) * 2012-12-17 2016-04-13 华为技术有限公司 Storage system, method and device for controlling cluster metadata
CN105786655A (en) * 2016-03-08 2016-07-20 成都云祺科技有限公司 Repeated data deleting method for virtual machine backup data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006008593A1 (en) * 2004-07-14 2006-01-26 Nokia Corporation Grouping of session objects
CN101656094A (en) * 2009-09-25 2010-02-24 杭州华三通信技术有限公司 Data storage method and storage device
CN102088389A (en) * 2009-12-02 2011-06-08 中兴通讯股份有限公司 Distributed content access scheduling device and content reading method
CN102024059A (en) * 2010-12-31 2011-04-20 成都市华为赛门铁克科技有限公司 Method and device for protecting redundant array of independent disk in file system
CN104166524A (en) * 2014-08-19 2014-11-26 浪潮电子信息产业股份有限公司 Processing method of metadata and data
CN105159607A (en) * 2015-08-28 2015-12-16 浪潮(北京)电子信息产业有限公司 Discrete storage based high-speed writing method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113312355A (en) * 2021-06-15 2021-08-27 北京沃东天骏信息技术有限公司 Data management method and device

Also Published As

Publication number Publication date
CN108271420B (en) 2020-11-27
CN108271420A (en) 2018-07-10

Similar Documents

Publication Publication Date Title
US11520670B2 (en) Method and apparatus for restoring data from snapshots
US11138156B2 (en) Continuous data management system and operating method thereof
US20200371883A1 (en) Remote Data Replication Method and System
US9785518B2 (en) Multi-threaded transaction log for primary and restore/intelligence
US20190146946A1 (en) Method and device for archiving block data of blockchain and method and device for querying the same
CN106547859B (en) Data file storage method and device under multi-tenant data storage system
US7861049B2 (en) Methods and apparatus for archiving digital data
US9547706B2 (en) Using colocation hints to facilitate accessing a distributed data storage system
CN104156278A (en) File version control system and file version control method
JP2020506444A (en) Expired backup processing method and backup server
JP7215971B2 (en) METHOD AND APPARATUS FOR PROCESSING DATA LOCATION IN STORAGE DEVICE, COMPUTER DEVICE AND COMPUTER-READABLE STORAGE MEDIUM
JP2019523955A (en) Data storage system and method for performing data storage
AU2013403132A1 (en) Data storage method, data storage apparatus, and storage device
CN106657356A (en) Data writing method and device for cloud storage system, and cloud storage system
CN108271420B (en) Method, file system and server system for managing files
CN116467277A (en) Metadata processing method, device, equipment, storage medium and product
CN116303325A (en) Method, system, equipment and storage medium for protecting remote copy data
JP2017208113A (en) Data storage method, data storage apparatus, and storage device
CN116483284B (en) Method, device, medium and electronic equipment for reading and writing virtual hard disk
US11645333B1 (en) Garbage collection integrated with physical file verification
WO2017054643A1 (en) Data recovery method and file server
US12204666B2 (en) Continuous data protection system and method for modern applications
US11669501B2 (en) Address mirroring of a file system journal
US20190034282A1 (en) Offline repopulation of cache
US20240403169A1 (en) Data Processing System and Method, and Device

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: 16920496

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16920496

Country of ref document: EP

Kind code of ref document: A1