温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Mutation相关类有哪些

发布时间:2021-12-18 16:58:26 来源:亿速云 阅读:121 作者:小新 栏目:云计算

这篇文章给大家分享的是有关Mutation相关类有哪些的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

MutationImpl类说明:

struct MutationImpl {
     metareqid_t           reqid;
     __u32                     attempt;
     LogSegment          *ls;                    提交的log片段
     utime_t                   mds_stamp;     mds本地时间戳
     utime_t                   op_stamp;        客户端提供的时间戳
     mds_rank_t            slave_to_mds;     若slave_to_mds>0则说明此Mutation是slave发起的
     set<MDSCacheOjbect *> pins;          mds cache pins
     set<CInode*>         stickydirs;            
     map<MDSCacheObject*, mds_rank_t> remote_auth_pins;     远端的auth pins
     set<MDSCacheObject*> auth_pins;                                         本地的auth pins
     list<CInode*> projected_inodes;
     list<CDir*> projected_fnodes;
     list<ScatterLock*> updated_locks;
     list<CInode*> dirty_cow_inodes;
     list<pair<CDentry*, version_t>> dirty_cow_dentries;
};

MutationImpl类方法:

MutationImpl::get_client()

|__若reqid.name.is_client()不为空

     |__说明请求是从client发出的,返回client信息,即:client_t(reqid.name.num())

|__返回-1

MutationImpl::apply()

|__遍历并清空projected_inodes数组且每个数组成员执行pop_and_dirty_projected_inode(ls)函数

|__遍历并清空projected_fnodes数组且每个数组成员执行pop_and_dirty_projected_fnode(ls)函数

|__遍历dirty_cow_inodes数组

     |__数组中每个成员执行_mark_dirty(ls)

|__遍历dirty_cow_dentries数组

     |__数组中每个成员执行_mark_dirty(ls)

|__遍历updated_locks数组

     |__数组中每个成员执行mark_dirty()

MutationImpl::cleanup()

|__遍历auth_pins数组

     |__数组中每个成员执行auth_unpin()

|__清空auth_pins数组

|__遍历pins数组

     |__数组中每个成员执行put()

|__清空pins数组

MDRequestImpl主要记录来自client的请求、slave的请求以及内部的操作internal_op。

struct MDRequestImpl: public MutationImpl, public TrackedOp {
   Session *session;                    记录session信息
   elist<MDRequestImpl*>::item item_session_request;    请求项
   MClientRequest *client_request;            客户端请求
   vector<CDentry*> dn[2];                保存两套dentry
   CInode *in[2];                    保存两套inode
   CDentry *straydn;                    记录stray的dentry
   snapid_t snapid;                    记录snap ID信息
   indoeno_t alloc_ino, used_prealloc_ino;        分配的inode号
   interval_set<inodeno_t> prealloc_inos;        预分配的inode号
   int snap_caps;                    snap capability
   int getattr_caps;                    执行getattr的权限
   bool did_early_reply;                    
   bool o_trunc;                        请求是一个O_TRUNC事件
   bool has_completed;                    请求已经完成
   bufferlist reply_extra_bl;                在回复中包含的额外的内容
   map<vinodeno_t, ceph_seq_t> cap_releases;        
   MMDSSlaveRequest *slave_request;            slave的请求
   int internal_op;                    内部操作
   Context *internal_op_finish;                内部操作的回调函数
   void *internal_op_private;                内部操作的私有对象
   int retry;                        记录rety的次数
   bool waited_for_osdmap;                是否需要等待更新的osmap
   struct More {
     int slave_error;
     set<mds_rank_t> slaves;                发起slave请求的集合
     set<mds_rank_t> waiting_on_slave;            等待slavereq reply的peer
     set<mds_rank_t> witnessed;    
     CInode *rename_inode;                保存freeze的inode信息
     bool is_freeze_authpin;                保存是否执行了freeze authpin操作
     bool is_remote_frozen_authpin;            保存是否执行了remote frozen authpin操作
     bool is_ambiguous_auth;                保存是否执行了ambiguous auth操作
   }_more;
 };

MDRequestImpl类方法:
MDRequestImpl::~MDRequestImpl()
|__若client_request不为空
  |__执行client_request->put()方法,尝试释放client_request
|__若slave_request不为空
  |__执行slave_request->put()方法,尝试释放slave_request
|__删除_more类对象

MDRequestImpl::freeze_auth_pin(inode)
|__设置_more中的rename_inode为inode
|__设置_more中的is_freeze_authpin为true
|__调用auth_pin(inode)
|__执行inode的freeze_auth_pin()

MDRequestImpl::unfreeze_auth_pin(clear_inode)
|__从_more中的rename_inode得到freeze的inode
|__若inode当前是is_frozen_auth_pin()
  |__执行inode的unfreeze_auth_pin()来解除freeze
|__若inode当前不是is_frozen_auth_pin()
  |__执行inode的unfreeze_inode()
|__设置_more中的is_freeze_autpin为false
|__若clear_inode==true
  |__设置_more中的rename_inode为null

MDRequestImpl::set_remote_frozen_auth_pin(inode)
|__设置_more中的rename_inode为inode
|__设置_more中的is_remote_frozen_authpin为true

MDRequestImpl::set_ambiguous_auth(inode)
|__执行inode的set_ambiguous_auth()函数
|__设置_more中的rename_inode为inode
|__设置_more中的is_ambiguous_auth为true

MDRequestImpl::clear_ambiguous_auth()
|__从_more中的rename_inode得到ambiguous的inode
|__执行inode的clear_ambiguous_auth()函数
|__设置_more中的is_ambiguous_auth为false

MDRequestImpl::can_auth_pin(object)
|__若object能auth pin或者object在auth_pin或remote auth pin中或者_more中的is_freeze_authpin为true或者_more中的rename_inode==object
  |__返回true
|__返回false

MDRequestImpl::drop_local_auth_pins()
|__若_more不为空
  |__调用unfreeze_auth_pin(true)来清除freeze的auth pin
|__调用MutationImpl::drop_local_auth_pins()    来清除本地的auth pins 

MDRequestImpl::set_filepath(fp)
|__设置_more中的filepath2为fp

MDRequestImpl::set_filepath3(fp)
|__设置_more中的filepath3为fp

MDRequestImpl::get_filepath()
|__若client_request不为空
  |__返回client_request->get_filepath()
|__返回_more中的filepath2

MDRequestImpl::get_filepath3()
|__若client_request不为空
  |__返回client_request->get_filepath3()
|__返回_more中的filepath3
 

感谢各位的阅读!关于“Mutation相关类有哪些”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI