cephfslinuxkernelclient针对export的操作代码

这篇文章主要介绍cephfs linux kernel client针对export的操作代码,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

成都服务器托管,创新互联提供包括服务器租用、眉山联通机房、带宽租用、云主机、机柜租用、主机租用托管、CDN网站加速、国际域名空间等业务的一体化完整服务。电话咨询:18980820575

const struct export_operations ceph_export_ops = {

        .encode_fh = ceph_encode_fh,

        .fh_to_dentry = ceph_fh_to_dentry,

        .fh_to_parent = ceph_fh_to_parent,

        .get_parent = ceph_get_parent,

        .get_name = ceph_get_name,

};

ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, struct inode *parent_inode)

|__调用ceph_snap(inode)函数检查inode是否包含snap信息,若包含snap则直接返回

|__输入参数校验

    |__若parent_inode不为空且max_len小于sizeof(struct ceph_nfs_confh)/4

        |__设置max_len=sizeof(struct ceph_nfs_confh)/4

        |__直接返回

    |__若parent_inode为空且max_len小于sizeof(struct ceph_nfs_fh)/4

        |__设置max_len=sizeof(struct ceph_nfs_fh)/4

        |__直接返回

|__若parent_inode不为空

    |__设置struct ceph_nfs_confh的ino为inode的ino

    |__设置struct ceph_nfs_confh的parent_ino为parent_inode的ino

    |__设置max_len为sizeof(struct ceph_nfs_confh)/4

    |__返回FILEID_INO32_GEN_PARENT

|__若parent_inode为空

    |__设置struct ceph_nfs_fh的ino为inode的ino

    |__设置max_len为sizeof(struct ceph_nfs_fh)/4

    |__返回FILEID_INO32_GEN

ceph_fs_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, int fh_type)

|__通过fid得到struct ceph_nfs_fh对象

|__检查fh_type是否是FILEID_INO32_GEN或FILEID_INO32_GEN_PARENT,若不是则直接返回

|__调用__fh_to_dentry(sb, fh->ino)函数找到fh->ino对应的dentry结构

__fh_to_dentry(struct super_block *sb, u64 ino)

|__通过sb得到struct ceph_mds_client结构

|__调用ceph_find_inode()函数得到ino指定的struct inode结构

|__若struct inode结构为空

    |__调用ceph_mdsc_create_request(CEPH_MDS_OP_LOOKUPINO)函数创建查找指定inode的请求

    |__调用ceph_mdsc_do_reqeust()函数将请求发送给mds集群得到指定inode number对应的inode结构

|__调用d_obtain_alias(inode)函数得到inode对应的dentry信息

|__调用ceph_init_dentry()函数来初始化dentry数据结构

ceph_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len, int fh_type)

|__通过sb得到struct ceph_mds_client结构

|__调用__get_parent()函数获取cfh->ino对应的parent的dentry结构

|__若获取parent的dentry结构失败

    |__调用__fh_to_dentry(sb, cfh->parent_ino)函数获取parent_ino对应的dentry结构

__get_parent(struct super_block *sb, struct dentry *child, u64 ino)

|__通过sb得到struct ceph_mds_client结构

|__调用ceph_mdsc_create_request(CEPH_MDS_OP_LOOKUPPARENT)函数创建查找parent inode的请求

|__调用ceph_mdsc_do_request()函数将请求发送给mds集群

|__从请求的r_target_inode字段得到parent inode信息

|__调用d_obtain_alias(inode)函数得到inode对应的dentry

|__调用ceph_init_dentry(dentry)函数初始化dentry数据结构

ceph_get_parent(struct dentry *child)

|__调用ceph_snap()函数检查child是否包含snap,若包含snap则直接返回

|__调用__get_parent()函数获取child对应parent的dentry结构

ceph_get_name(struct dentry *parent, char *name, struct dentry *child)

|__从child得到struct ceph_mds_client数据结构

|__调用ceph_mdsc_create_request(CEPH_MDS_OP_LOOKUPNAME)函数创建查找inode name的请求

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

|__调用memcpy()函数将请求的返回信息中的dname复制到name中

以上是“cephfs linux kernel client针对export的操作代码”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


分享名称:cephfslinuxkernelclient针对export的操作代码
URL分享:http://bzwzjz.com/article/psegjg.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 外贸网站设计方案 成都网站制作 成都企业网站制作 成都网站建设公司 做网站设计 营销网站建设 定制网站建设 成都网站设计 营销型网站建设 成都网站制作 重庆外贸网站建设 重庆网站建设 成都网站建设 app网站建设 成都网站建设推广 成都网站建设 成都网站制作 成都h5网站建设 成都网站建设 成都响应式网站建设公司 成都品牌网站建设 成都网站设计