The invention discloses a method and a system for creating a file system snapshot tree, the method includes: to determine whether there is SnapRealm structure of inode metadata in the current directory; if not, the inode metadata from the current directory to create SnapRealm according to the structure; from the current directory to find the structure of the SnapRealm traversal contains the parent directory, SnapRealm the structure of the current directory into the open_children container to the parent directory of the SnapRealm structure; and through structure relationship such as parent and open_children, when the snapshot query in the file system, not all the directory level of a query file system, solves the problem that when the number of the directory in the file system is too large, query all the snapshots in the file system is time-consuming for serious problems, improve the efficiency of query snapshot.
【技术实现步骤摘要】
一种创建文件系统快照树的方法及系统
本专利技术涉及文件系统快照
,特别是涉及一种创建文件系统快照树的的方法及系统。
技术介绍
随着信息技术的发展,电子数据逐渐成为人们进行信息交流和信息传递的主要媒介,对于某些电子数据便需要将其保存下来,防止数据丢失造成损失。快照技术是一种电子文件摄影技术,随着存储应用需求的提高,用户需要在线方式进行数据保护,快照就是在线存储设备防范数据丢失的有效方法之一,在过去十年时间中,快照已经成为磁盘阵列、卷管理器、文件系统甚至PCIRAID(独立磁盘冗余阵列)控制器的标准配置功能。越来越多的设备都开始支持这项功能。越来越多的存储设备支持快照功能,在这些产品的资料中宣传了各自快照技术的优势,有的是快照数量多,有的是占用空间小。文件快照功能主要是应用于文件系统中,对目录的快照操作,以便依据已生成快照进行回滚(恢复)数据。文件快照支持快照、查看、删除和回滚操作。其中设置快照可对一个目录设置多次快照,依据快照时间点进行数据恢复。现有技术中,查询文件系统中的快照,需一级一级查询文件系统所有的目录,这样若文件系统中的目录数量过大时,查询文件系统中 ...
【技术保护点】
一种创建文件系统快照树的方法,其特征在于,包括:判断当前目录的inode元数据中是否存在SnapRealm结构体;若否,根据所述当前目录的inode元数据创建SnapRealm结构体;从所述当前目录向上遍历查找含有SnapRealm结构体的父目录,将所述当前目录的SnapRealm结构体插入所述父目录SnapRealm结构体的open_children容器中;将所述父目录SnapRealm结构体设置为所述当前目录的SnapRealm结构体的parent结构体。
【技术特征摘要】
1.一种创建文件系统快照树的方法,其特征在于,包括:判断当前目录的inode元数据中是否存在SnapRealm结构体;若否,根据所述当前目录的inode元数据创建SnapRealm结构体;从所述当前目录向上遍历查找含有SnapRealm结构体的父目录,将所述当前目录的SnapRealm结构体插入所述父目录SnapRealm结构体的open_children容器中;将所述父目录SnapRealm结构体设置为所述当前目录的SnapRealm结构体的parent结构体。2.根据权利要求1所述的方法,其特征在于,在将所述当前目录的SnapRealm结构体插入所述父目录SnapRealm结构体的open_children容器中之后,还包括:判断所述当前目录的下级目录中是否存在SnapRealm结构体;若是,将所述下级目录中的SnapRealm结构体插入所述当前目录的SnapRealm结构体的open_children容器中。3.根据权利要求2所述的方法,其特征在于,在将所述下级目录中的SnapRealm结构体插入所述当前目录的SnapRealm结构体的open_children容器中之前还包括:若所述下级目录SnapRealm结构体的parent结构体在所述父目录中,则将所述下级目录SnapRealm结构体的parent结构体改为所述当前目录的SnapRealm结构体。4.根据权利要求1至3任一项所述的方法,其特征在于,还包括:当对目录进行快照操作时,将目录的快照信息保存在SnapRealm...
【专利技术属性】
技术研发人员:罗浩,
申请(专利权)人:郑州云海信息技术有限公司,
类型:发明
国别省市:河南,41
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。