cephfs kernel client針對dentry的操做

cephfs kernel client針對dentry的操做node

const struct dentry_operations ceph_dentry_ops = {session

        .d_revalidate = ceph_d_revalidate,數據結構

        .d_release = ceph_d_release,函數

        .d_prune = ceph_d_prune,進程

};get

 

ceph_d_revalidate(struct dentry *dentry, unsigned int flags)    用於檢查cache中的dentry是否有效同步

|__調用dget_parent()函數獲得dentry對應的parent dentryhash

|__調用d_inode()函數獲得parent dentry對應的struct inode數據io

|__調用dentry_lease_is_valid()函數檢查dentry lease是否有效cli

|__若無效

    |__獲得操做碼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的引用計數值

相關文章
相關標籤/搜索