2019独角兽企业重金招聘Python工程师标准>>>

EMetaBlob用于记录CDir和CDentry的Log

EMetaBlob类说明:

class EMetaBlob: public LogEvent {

};

EMetaBlob类的方法:

EMetaBlob::add_dir_context(dir, mode)                    将dir及其父目录添加到EMetaBlob类中

|__检查当前lump_map集合中是否已经包含dir

|__直接返回

|__从dir目录开始依次向根目录遍历

|__得到dir的CInode(diri)和CDentry(parent)

|__若mode==TO_AUTH_SUBTREE_ROOT

|__若dir是subtree_root并且已经是auth的

|__退出遍历

|__若dir是subtree_root但不是auth的

|__将maybe数组(CDentry list)插入到parents数组的首部

|__若diri已经journal过了

|__退出遍历

|__若diri->last_journaled >= last_subtree_map     说明从last subtree map开始,该inode已经写入日志了

|__maybenot=true

|__若已经是根目录了(parent为空)

|__退出遍历

|__maybenot==true

|__将parent插入到maybe数组中

|__maybenot==false

|__将parent插入到parents数组中

|__dir=parent->get_dir()               从当前dir开始向根目录递进

|__将maybe数组插入到parents数组的首部

|__遍历parents数组

|__add_dentry()               将parents数组中成员添加到EMetaBlob类中

EMetaBlob::update_segment(ls)          更新LogSegment的inotablev和sessionmapv

|__若inotablev不为空

|__ls->inotablev=inotablev

|__若sessionmapv不为空

|__ls->sessionmapv=sessionmapv

EMetaBlob::fullbit::update_inode(mds, in)

|__用EMedaBlob类对象中的数据初始化CInode类对象

EMetaBlob::get_inodes(inodes)

|__遍历lump_map集合

|__得到lump_map结合中每个成员的dirfrag的inode号

|__将inode号插入到inodes数组中

|__从lump_map中得到dirlump信息

|__遍历dirlump中的fullbit

|__将dirlump中fullbit对应的inode号插入到inodes数组中

|__遍历dirlump中的remotebit

|__将remotebit的inode号插入到inodes数组中

EMetaBlob::get_dentries(dentries)

|__遍历lump_map集合

|__从lump_map中得到dirlump信息

|__从dirlump结构中分别得到full_dentry/remote_dentry/null_dentry信息

|__遍历full_dentry数组

|__将full_dentry数组中成员的dn(dentry name)插入到dentries数组中

|__遍历remote_dentry数组

|__将remote_dentry数组中成员的dn(dentry name)插入到dentries数组中

|__遍历null_dentry数组

|__将null_dentry数组中成员的dn(dentry name)插入到dentries数组中

EMetaBlob::get_paths(paths)                         从dirlump结构中得到所有的绝对目录信息

|__若lump_map为空且roots不为空

|__将”/“插入到paths数组

|__遍历lump_map集合

|__得到full_dentry/remote_dentry/null_dentry数组

|__遍历full_dentry数组

|__将full_dentry数组成员中的dentry name插入到children数组中,即:children[dir_ino].push_back(dentry)

|__更新ino_locations数组,即:ino_locations[(*iter)->inode.ino] = Location(dir_ino, dentry)

|__遍历remote_dentry数组

|__将remote_dentry数组成员中的dentry name插入到children数组中,即:children[dir_ino].push_back(dentry)

|__遍历null_dentry数组

|__将null_dentry数组成员中的dentry name插入到children数组中,即:children[dir_ino].push_back(dentry)

|__遍历lump_map集合

|__得到full_dentry/remote_dentry/null_dentry数组

|__遍历full_dentry数组

|__若在children数组中没有找到对应的节点,则说明此节点是叶子节点

|__将节点的inode和dentry信息插入到leaf_locations数组中,即:leaf_locations.push_back(Location(dir_ino, dentry))

|__遍历remote_dentry数组

|__将节点的inode和dentry信息插入到leaf_locations数组中,即:leaf_locations.push_back(Location(dir_ino, dentry))

|__遍历null_dentry数组

|__将节点的inode和dentry信息插入到leaf_locations数组中,即:leaf_locations.push_back(Location(dir_ino, dentry))

|__遍历leaf_locations数组

|__得到inode号和对应的path

|__在ino_locations数组中遍历查找inode号,若查找成功

|__将ino_locations数组中对应的path值添加到path的前面,即:构成当前path的上一级path目录信息

|__inode号更新为ino_locations对应的inode号

|__将得到的path值插入到paths数组中

EMetaBlob::replay(mds, logseg, slaveup)

|__遍历roots数组

|__从MDCache中得到CInode信息,即:mds->mdcache->get_inode()

|__若MDCache中没有CInode信息

|__创建一个新的CInode类对象

|__EMetaBlob::fullbit::update_inode()          使用fullbit信息更新CInode信息

|__若roots成员是dirty的

|__设置CInode为dirty

|__若renamed_dirino不为空

|__从MDCache中得到CInode信息,即:mds->mdcache->get_inode(renamed_dirino)

|__遍历lump_order数组

|__从lump_map数组中得到dirlump信息

|__dirlump的nnull不为空

|__更新nnull个数,即:nnull += lump.nnull

|__遍历lump_order数组

|__从lump_map数组中得到dirlump信息

|__从MDCache中得到dirfrag对应的CDir信息,即:mds->mdcache->get_force_dirfrag()

|__若CDir为空

|__从MDCache中得到该CDir对应的CInode信息,即:mds->mdcache->get_inode()

|__若CInode为空

|__若CDir对应的CInode号是MDSDIR的范围

|__从MDCache中创建一个CInode,即:mds->mdcache->create_system_inode()

|__清除新建的CInode的AUTH标识,即:diri->state_clear(STATE_AUTH)

|__若CDir对应的CInode号不是MDSDIR的范围

|__assert(0)

|__根据CInode得到CDir信息,即:diri->get_or_open_dirfrag()

|__若CInode对应的号是ROOT或MDSDIR

|__调整subtree的auth,即:mds->mdcache->adjust_subtree_auth()

|__设置CDir的version/fnode信息

|__若dirlump是is_importing()

|__设置CDir STATE_AUTH标志,清除STATE_COMPLETE标志

|__若dirlump是is_dirty()

|__CDir::_mark_dirty()

|__若dir->fnode.rstat != dir->fnode.accounted_rstat          说明有dirty nestinfo

|__mds->locker->mark_updated_scatterlock()

|__logseg->dirty_dirfrag_nest.push_back(dir->inode->item_dirty_dirfrag_nest)

|__若dir->fnode.fragstat != dir->fnode.accounted_fragstat     说明有dirty fragstat

|__mds->locker->mark_updated_scatterlock()

|__logseg->dirty_dirfrag_dir.push_back(dir->inode->item_dirty_dirfrag_nest)

|__若lump是is_dirty_dft()

|__设置dir的状态为DIRTYDFT,即:dir->state_set(STATE_DIRTYDFT)

|__mds->locker->mark_updated_scatterlock()

|__logseg->dirty_dirfrag_dirfragtree.push_back(dir->inode->item_dirty_dirfrag_nest)

|__若lump是is_new()

|__设置dir是new的,即:dir->mark_new()

|__若lump是is_complete()

|__设置dir是complete的,即:dir->mark_complete()

|__从lump中解析出dfull/dremote/dnull信息,即:lump._decode_bits()

|__遍历full_dentry数组

|__得到dnlast对应的CDentry对象,即:dir->lookup_exact_snap(dn, dnlast)

|__若CDentry对象为空

|__向dir添加一个空的dentry,即:dir->add_null_dentry()

|__根据full_dentry的dentry version信息,设置dentry的版本信息

|__若CDentry对象不为空

|__根据full_dentry的dentry version信息,设置dentry的版本信息

|__设置dentry的first为full_entry的dnfirst

|__若lump是is_importing()

|__设置dentry的状态为AUTH,即:dn->state_set(STATE_AUTH)

|__从MDCache中得到dnlast的CInode信息,即:mds->mdcache->get_inode(ino, dnlast)

|__若CInode信息为空

|__创建一个新的CInode类对象

|__使用full_dentry信息初始化新的CInode类对象,即:p->update_inode(mds, in)

|__将新的CInode添加到MDCache中,即:mds->mdcache->add_inode(in)

|__若dentry的linkage不为空

|__若dentry的linkage是primary

|__将dir放入到unlinked数组中               应该被删除掉的

|__解除dir和dentry之间的对应关系,即:dir->unlink_inode(dn)

|__若CInode位于unlinked数组中

|__将CInode插入到linked数组中

|__设置dir的primary link inode,即:dir->link_primary_inode(dn, in)

|__若CInode信息不为空

|__设置CInode的first值,即:in->first = p->dnfirst

|__使用full_dentry信息初始化新的CInode类对象,即:p->update_inode(mds, in)

|__若dentry的linkage不是CInode并且CInode有parent dentry

|__将CInode的parent dir放入unlinked数组

|__解除CInode与其parent dir的对应关系,即:in->get_parent_dir()->unlink_inode(in->get_parent_dn())

|__若dentry的linkage不是CInode

|__若dentry的linkage不为空

|__若dentry的linkage是primary

|__将dir放入到unlinked数组中               应该被删除掉的

|__解除dir和dentry之间的对应关系,即:dir->unlink_inode(dn)

|__若CInode位于unlinked数组中

|__将CInode插入到linked数组中

|__设置dir的primary link inode,即:dir->link_primary_inode(dn, in)

|__若full_dentry是is_dirty()

|__设置CInode为dirty, 即:in->_mark_dirty(logseg)

|__若full_dentry是is_dirty_parent()

|__设置CInode为dirty parent,即:in->_mark_dirty_parent()

|__若dentry是is_auth()

|__设置CInode的状态为AUTH,即:in->state_set(STATE_AUTH)

|__遍历remote dentry数组

|__得到dnlast对应的CDentry对象,即:dir->lookup_exact_snap(dn, dnlast)

|__若CDentry对象为空

|__向dir添加一个新的remote dentry,即:dir->add_remote_dentry()

|__根据remote_dentry的dentry version信息,设置dentry的版本信息

|__若CDentry对象不为空

|__若dentry的linkage不为空

|__若dentry的linkage是primary

|__将dir插入到unlinked数组中

|__解除dir与dentry之间的关联,即:dir->unlink_inode(dn)

|__向dir添加remote inode,即:dir->link_remote_inode()

|__根据remote_dentry的dentry version信息,设置dentry的版本信息

|__设置dentry的first为remote_dentry的first

|__若lump是is_importing()

|__设置dentry的状态为AUTH,即:dn->state_set(STATE_AUTH)

|__遍历null_dentry数组

|__得到dnlast对应的CDentry对象,即:dir->lookup_exact_snap(dn, dnlast)

|__若CDentry对象为空

|__向dir添加一个新的remote dentry,即:dir->add_remote_dentry()

|__根据remote_dentry的dentry version信息,设置dentry的版本信息

|__若CDentry对象不为空

|__设置dentry的first为null_dentry的first

|__若dentry的linkage不为空

|__将dir插入到unlinked数组中

|__解除dir与dentry之间的关联,即:dir->unlink_inode(dn)

|__根据null_dentry的版本信息,设置dentry的版本信息

|__若lump是is_importing()

|__设置dentry的状态为AUTH,即:dn->state_set(STATE_AUTH)

|__若renamed_dirino不为空

|__若renamed_diri不为空

|__设置olddir为unlinked[renamed_diri]

|__若renamed_diri为空

|__从MDCache中得到renamed_diri,即:mds->mdcache->get_inode(renamed_dirino)

|__若olddir不为空

|__从renamed_diri的dirfragtree上得到所有的叶子节点,即:renamed_diri->dirfragtree.get_leaves()

|__遍历叶子节点

|__根据叶子节点找到对应的CDir信息

|__若CDir没有被认证

|__将CDir对应的CInode插入到slaveup的olddirs中,即:slaveup->olddirs.insert(dir->inode)

|__若CDir被认证

|__设置dir的状态为AUTH,即:dir->state_set(STATE_AUTH)

|__更新MDCache中的subtree信息,即:mds->mdcache->adjust_subtree_after_rename()

|__从MDCache中得到olddir的subtree_root的CDir信息

|__若subtree_root未认证

|__若slaveup不为空

|__将olddir对应的CInode插入到slaveup的olddirs中,即:slaveup->olddirs.insert(dir->inode)

|__若slaveup为空

|__更新MDCache的subtree信息,即:mds->mdcache->try_trim_non_auth_subtree()

|__若renamed_diri被认证

|__遍历renamed_dir_frags数组

|__从renamed_diri这个CInode得到其dirfrag的CDir信息,即:reanmed_diri->get_dirfrag()

|__若CDir信息存在

|__遍历下一个

|__创建一个新的CDir对象,即:renamed_diri->get_or_open_dirfrag()

|__清除新建的CDir的AUTH,即:dir->state_clear(STATE_AUTH)

|__调整MDCache中的subtree信息,即:mds->mdcache->adjust_subtree_auth()

|__从unlinked数组中删除renamed_diri

|__遍历unlined数组

|__调整MDCache中的subtree信息,即:mds->mdcache->adjust_subtree_after_rename()

|__若unlinked数组不为空

|__遍历linked数组

|__从unlinked数组中删除linked数组中的成员

|__遍历unlinked数组

|__若slaveup不为空

|__将unlinked信息插入到slaveup的unlinked数组中,即:slaveup->unlinked.insert()

|__若slaveup为空

|__更新MDCache,即:mds->mdcache->remove_inode_recursive()

|__遍历table_tids数组(遍历table client)

|__得到MDSTableClient类对象,即:mds->get_table_client()

|__执行client的got_journaled_agree()函数,即:client->got_journaled_agree()

|__若opened_ino不为空

|__从MDCache中得到opened_ino对应的CInode,即:mds->mdcache->get_inode()

|__将CInode的item_open_file插入到logseg的open_files数组中,即:logseg->open_files.push_back()

|__若inotablev不为空

|__若mds的inotable版本号小于inotablev

|__若allocated_ino不为空

|__重新分配inode号,即:mds->inotable->replay_alloc_id()

|__若preallocated_inos不为空

|__重新分配inode号,即:mds->inotable->replay_alloc_id()

|__若sessionmapv不为空

|__若mds的sessionmap版本号+2>=sessionmapv

|__根据client_name得到session信息,即:mds->sessionmap.get_session()

|__若session不为空

|__重新执行dirty的session,即:mds->sessionmap.replay_dirty_session()

|__若session为空

|__执行advance version,即:mds->sessionmap.replay_advance_version()

|__遍历truncate_start数组

|__从MDCache中得到对应的CInode信息,即:mds->mdcache->get_inode()

|__在MDCache中执行add recovered truncate,即:mds->mdcache->add_recovered_truncate()

|__遍历truncate_finish数组

|__从MDLog中得到对应的LogSegment,即:mds->mdlog->get_segment()

|__从MDCache中得到对应的CInode信息,即:mds->mdcache->get_inode()

|__在MDCache中执行remove recovered truncate,即:mds->mdcache->remove_recovered_truncate()

|__遍历destroyed_inodes数组

|__从MDCache中得到对应的CInode信息,即:mds->mdcache->get_inode()

|__在MDCache中删除对应的CInode,即:mds->mdcache->remove_inode()

|__遍历client_reqs数组

|__从sessionmap中得到对应的Session类对象,即:mds->sessionmap.get_session()

|__在Session对象中添加completed request,即:session->add_completed_request()

|__若client_reqs数组中包含trim的session

|__在Session对象中执行trim completed request,即:session->trim_completed_request()

|__遍历client_flushes数组

|__从sessionmap中得到对应的Session类对象,即:mds->sessionmap.get_session()

|__在Session对象中添加completed request,即:session->add_completed_request()

|__若client_reqs数组中包含trim的session

|__在Session对象中执行trim completed request,即:session->trim_completed_request()

|__更新LogSegment信息,即:update_segment(logseg)

转载于:https://my.oschina.net/linuxhunter/blog/715206

EMetaBlob类分析相关推荐

  1. Android消息驱动Handler类分析

    Android系统中的消息驱动工作原理: 1.有一个消息队列,可以往这个消息队列中投递消息; 2.有一个消息循环,不断的从消息队列中取得消息,然后处理. 工作流程: 1.事件源将待处理的消息加入到消息 ...

  2. 复杂稀缺类分析:稀缺与不重要能否划等号?

    ⬆⬆⬆              点击蓝字 关注我们 AI TIME欢迎每一位AI爱好者的加入! 在当代众多领域以及应用中,稀缺类经常扮演着极为重要的角色,如金融诈骗检测,流行预测,稀有疾病诊断等.然 ...

  3. 问卷研究的五类分析思路模板

    问卷调查作为一种最常用的省时省力,能对事物进行比较全面系统的调查方法,无论是在日常工作还是学术研究中都倍受青睐.但一次问卷调查不是那么容易就可以完成的,随着问卷收集完毕,大量的数据等待着被整理.统计. ...

  4. selenium源码通读·5 |webdriver/common/action_chains.py-ActionChains类分析

    ·5 |webdriver/common/action_chains.py-ActionChains类分析 1 源码路径 2 功能描述 3 使用方法 4 几个方法 4.1 `__init__`方法 4 ...

  5. ②、iOS-RAC-核心类分析-RACPassthroughSubscriber订阅者-RACScheduler调度者-RACDisposable销毁者-RACObseve监听者-RACSubject

    iOS RAC系列 ①.iOS-RAC的开发用法-底层分析以及总结 ②.iOS-RAC-核心类分析-RACPassthroughSubscriber订阅者-RACScheduler调度者-RACDis ...

  6. 实验12-SPSS-聚类分析-公司员工绩效评估

     SPSS-聚类分析介绍 聚类分析,就是按照个体的特征将他们分类,目的在于让同一个类别内的个体之间具有较高的相似度,而不同类别之间具有较大的差异性. 我们可以对变量进行聚类,但是更常见的还是对个体进行 ...

  7. disruptor笔记之二:Disruptor类分析

    欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos <disruptor笔记>系列链接 快速入 ...

  8. pytest源码解读HookspecMarker类和HookimplMarker类分析

    1 pluggy简介 pluggy是一个非常优秀的插件系统,它是理解pytest的核心,只有理解了pluggy的原理,才能更好的理解和使用pytest,否则见到了pytest的很多应用都会感觉很难理解 ...

  9. hive执行流程(3)-Driver类分析1Driver类整体流程

    Driver类是对 1 org.apache.hadoop.hive.ql.processors.CommandProcessor.java 接口的实现,重写了run方法,定义了常见sql的执行方式. ...

最新文章

  1. datagrid行内编辑时为datetimebox
  2. springboot 使用的配置
  3. 如何给 mongodb 设置密码
  4. 老李说事:性能测试服务日记
  5. ART、JIT、AOT、Dalvik之间有什么关系?
  6. 指纹识别 python_Python实现指纹识别你见过没?
  7. /plus/recommend.php sql注入漏洞,代码审计:ThinkPHP框架通杀所有版本的一个SQL注入漏洞详细分析及测试方法 | Seay 渗透 编程 代码审计 网络安全博客...
  8. 二分类数据集_玩转UCI心脏病二分类数据集 领学课笔记
  9. matlab统计车流量及车流密度,基于视频的车流量统计——matlab代码
  10. 萤火小程序商城V2.0开源版源码-支持小程序+H5+公众号+APP
  11. 人工智能技术与现代应用
  12. 如何提升你的面试机会?
  13. Burp Spider 使用指南
  14. python web py入门(3)-模板
  15. 不能用float、double 存储金额——BigDecimal详解
  16. 深度学习需要多强的数学基础?
  17. 2017全国计算机高校排名,全国计算机专业大学排名_2017计算机专业大学排名
  18. JAVA修炼之路的开启
  19. 老男孩基础搭建环境指南1.0
  20. 二级指针(指向指针的指针)

热门文章

  1. OpenCart之在线客服(Google Talk)模块教程
  2. C#开源磁盘/内存缓存引擎
  3. Extensible Messaging and Presence Protocol (XMPP): Core
  4. 修复Debian grub
  5. eclipse中Tomcat启动了 但看不到tomcat首页
  6. MikroTik RouterOS使用SATA光驱安装时提示:no CD-ROM found press ENTER to reboot
  7. 云+社区小程序知识周,等你来挑战!
  8. 备份TB级别Oracle数据库的一些技巧
  9. MYsql 查询 查询当前月份的数据
  10. Codis集群扩容方法