久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

cephfs linux kernel client針對export的操作代碼

154次閱讀
沒有評論

共計 2593 個字符,預(yù)計需要花費 7 分鐘才能閱讀完成。

這篇文章主要介紹 cephfs linux kernel client 針對 export 的操作代碼,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!

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)

|__調(diào)用 ceph_snap(inode) 函數(shù)檢查 inode 是否包含 snap 信息,若包含 snap 則直接返回

|__輸入?yún)?shù)校驗

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

     |__設(shè)置 max_len=sizeof(struct ceph_nfs_confh)/4

     |__直接返回

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

     |__設(shè)置 max_len=sizeof(struct ceph_nfs_fh)/4

     |__直接返回

|__若 parent_inode 不為空

   |__設(shè)置 struct ceph_nfs_confh 的 ino 為 inode 的 ino

   |__設(shè)置 struct ceph_nfs_confh 的 parent_ino 為 parent_inode 的 ino

   |__設(shè)置 max_len 為 sizeof(struct ceph_nfs_confh)/4

   |__返回 FILEID_INO32_GEN_PARENT

|__若 parent_inode 為空

   |__設(shè)置 struct ceph_nfs_fh 的 ino 為 inode 的 ino

   |__設(shè)置 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,若不是則直接返回

|__調(diào)用__fh_to_dentry(sb, fh- ino) 函數(shù)找到 fh- ino 對應(yīng)的 dentry 結(jié)構(gòu)

__fh_to_dentry(struct super_block *sb, u64 ino)

|__通過 sb 得到 struct ceph_mds_client 結(jié)構(gòu)

|__調(diào)用 ceph_find_inode() 函數(shù)得到 ino 指定的 struct inode 結(jié)構(gòu)

|__若 struct inode 結(jié)構(gòu)為空

   |__調(diào)用 ceph_mdsc_create_request(CEPH_MDS_OP_LOOKUPINO) 函數(shù)創(chuàng)建查找指定 inode 的請求

   |__調(diào)用 ceph_mdsc_do_reqeust() 函數(shù)將請求發(fā)送給 mds 集群得到指定 inode number 對應(yīng)的 inode 結(jié)構(gòu)

|__調(diào)用 d_obtain_alias(inode) 函數(shù)得到 inode 對應(yīng)的 dentry 信息

|__調(diào)用 ceph_init_dentry() 函數(shù)來初始化 dentry 數(shù)據(jù)結(jié)構(gòu)

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

|__通過 sb 得到 struct ceph_mds_client 結(jié)構(gòu)

|__調(diào)用__get_parent() 函數(shù)獲取 cfh- ino 對應(yīng)的 parent 的 dentry 結(jié)構(gòu)

|__若獲取 parent 的 dentry 結(jié)構(gòu)失敗

   |__調(diào)用__fh_to_dentry(sb, cfh- parent_ino) 函數(shù)獲取 parent_ino 對應(yīng)的 dentry 結(jié)構(gòu)

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

|__通過 sb 得到 struct ceph_mds_client 結(jié)構(gòu)

|__調(diào)用 ceph_mdsc_create_request(CEPH_MDS_OP_LOOKUPPARENT) 函數(shù)創(chuàng)建查找 parent inode 的請求

|__調(diào)用 ceph_mdsc_do_request() 函數(shù)將請求發(fā)送給 mds 集群

|__從請求的 r_target_inode 字段得到 parent inode 信息

|__調(diào)用 d_obtain_alias(inode) 函數(shù)得到 inode 對應(yīng)的 dentry

|__調(diào)用 ceph_init_dentry(dentry) 函數(shù)初始化 dentry 數(shù)據(jù)結(jié)構(gòu)

ceph_get_parent(struct dentry *child)

|__調(diào)用 ceph_snap() 函數(shù)檢查 child 是否包含 snap,若包含 snap 則直接返回

|__調(diào)用__get_parent() 函數(shù)獲取 child 對應(yīng) parent 的 dentry 結(jié)構(gòu)

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

|__從 child 得到 struct ceph_mds_client 數(shù)據(jù)結(jié)構(gòu)

|__調(diào)用 ceph_mdsc_create_request(CEPH_MDS_OP_LOOKUPNAME) 函數(shù)創(chuàng)建查找 inode name 的請求

|__調(diào)用 ceph_mdsc_do_request() 函數(shù)將請求同步發(fā)送給 mds 集群

|__調(diào)用 memcpy() 函數(shù)將請求的返回信息中的 dname 復(fù)制到 name 中

以上是“cephfs linux kernel client 針對 export 的操作代碼”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注丸趣 TV 行業(yè)資訊頻道!

正文完
 
丸趣
版權(quán)聲明:本站原創(chuàng)文章,由 丸趣 2023-08-16發(fā)表,共計2593字。
轉(zhuǎn)載說明:除特殊說明外本站除技術(shù)相關(guān)以外文章皆由網(wǎng)絡(luò)搜集發(fā)布,轉(zhuǎn)載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 黄大仙区| 汤原县| 乌拉特中旗| 淳安县| 阜阳市| 公安县| 余姚市| 都安| 夹江县| 保定市| 江阴市| 米林县| 双峰县| 德钦县| 邮箱| 临桂县| 剑阁县| 鞍山市| 乌鲁木齐市| 麻阳| 剑阁县| 灵寿县| 溆浦县| 白银市| 昭苏县| 阳信县| 剑川县| 宣城市| 赞皇县| 洛扎县| 上蔡县| 进贤县| 嘉荫县| 清水河县| 望奎县| 门头沟区| 社会| 福泉市| 凌源市| 正阳县| 贵阳市|