cephfs kernel client针对dentry的操作

cephfs kernel client针对dentry的操作

const struct dentry_operations ceph_dentry_ops = {

        .d_revalidate = ceph_d_revalidate,

        .d_release = ceph_d_release,

        .d_prune = ceph_d_prune,

};

 

ceph_d_revalidate(struct dentry *dentry, unsigned int flags)    用于检查cache中的dentry是否有效

|__调用dget_parent()函数得到dentry对应的parent dentry

|__调用d_inode()函数得到parent dentry对应的struct inode数据

|__调用dentry_lease_is_valid()函数检查dentry lease是否有效

|__若无效

    |__得到操作码op=CEPH_MDS_OP_LOOKUPSNAP或者CEPH_MDS_OP_LOOKUP

    |__调用ceph_mdsc_create_request()函数创建mds请求

    |__调用ceph_mdsc_do_request()函数将请求同步发送给mds进程

    |__调用ceph_dentry_lru_touch()函数将dentry添加到lru中

 

ceph_d_release(struct dentry *dentry)        释放dentry时被调用

|__调用ceph_dentry()函数得到struct ceph_dentry_info数据结构

|__调用ceph_dentry_lru_del()函数将dentry从lru中删除

|__设置dentry->d_fsdata=NULL

|__调用ceph_put_mds_session()函数释放lease session

|__调用kmem_cache_free()函数从cache中释放struct ceph_dentry_info数据结构

 

ceph_d_prune(struct dentry *dentry)        当vfs从cache中删除dentry时调用该函数

|__调用IS_ROOT()函数检查dentry是否包含有效的parent,若dentry是root则直接返回

|__调用d_unhashed()函数检查dentry是否不是hashed,若是则直接返回(未hashed dentry不受影响)

|__调用ceph_dir_clear_complete()函数减少dentry->parent的struct inode中的中的i_release_count的引用计数值

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值