Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Cephfs linux kernel client operation code for export

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the operation code of cephfs linux kernel client for export, which is very detailed and has certain reference value. Friends who are interested must finish reading it.

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)

| | _ _ call the ceph_snap (inode) function to check whether inode contains snap information, and return it directly if it contains snap |

| | _ _ input parameter verification |

| | _ _ if parent _ inode is not empty and max_len is less than sizeof (struct ceph_nfs_confh) / 4 |

| | _ _ set max_len=sizeof (struct ceph_nfs_confh) / 4 |

| | _ _ return directly |

| | _ _ if parent _ inode is empty and max_len is less than sizeof (struct ceph_nfs_fh) / 4 |

| | _ _ set max_len=sizeof (struct ceph_nfs_fh) / 4 |

| | _ _ return directly |

| | _ _ if parent _ inode is not empty |

| | _ _ set the ino of struct ceph_nfs_confh to the ino of inode |

| | _ _ set the parent_ino of struct ceph_nfs_confh to the ino of parent_inode |

| | _ _ set max_len to sizeof (struct ceph_nfs_confh) / 4 |

| | _ _ returns FILEID_INO32_GEN_PARENT |

| | _ _ if parent _ inode is empty |

| | _ _ set the ino of struct ceph_nfs_fh to the ino of inode |

| | _ _ set max_len to sizeof (struct ceph_nfs_fh) / 4 |

| | _ _ returns FILEID_INO32_GEN |

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

| | _ _ get the struct ceph_nfs_fh object through fid |

| | _ _ check whether fh_type is FILEID_INO32_GEN or FILEID_INO32_GEN_PARENT, and return it directly if not |

| | _ _ call _ _ fh_to_dentry (sb, fh- > ino) function to find the dentry structure corresponding to fh- > ino |

_ _ fh_to_dentry (struct super_block * sb, U64 ino)

| | _ _ get the struct ceph_mds_client structure through sb |

| | _ _ call the ceph_find_inode () function to get the struct inode structure specified by ino |

| | _ _ if struct inode structure is empty |

| | _ _ call the ceph_mdsc_create_request (CEPH_MDS_OP_LOOKUPINO) function to create a request to find the specified inode |

| | _ _ call the ceph_mdsc_do_reqeust () function to send the request to the mds cluster to get the inode structure corresponding to the specified inode number |

| | _ _ call the d_obtain_alias (inode) function to get the dentry information corresponding to inode |

| | _ _ call ceph_init_dentry () function to initialize dentry data structure |

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

| | _ _ get the struct ceph_mds_client structure through sb |

| | _ _ call _ _ get_parent () function to obtain the dentry structure of the parent corresponding to cfh- > ino |

| | _ _ if failed to obtain the dentry structure of parent |

| | _ _ call _ _ fh_to_dentry (sb, cfh- > parent_ino) function to obtain the dentry structure corresponding to parent_ino |

_ _ get_parent (struct super_block * sb, struct dentry * child, U64 ino)

| | _ _ get the struct ceph_mds_client structure through sb |

| | _ _ call the ceph_mdsc_create_request (CEPH_MDS_OP_LOOKUPPARENT) function to create a request to find parent inode |

| | _ _ call ceph_mdsc_do_request () function to send the request to the mds cluster |

| | _ _ get parent inode information from the r_target_inode field of the request |

| | _ _ call the d_obtain_alias (inode) function to get the dentry corresponding to inode |

| | _ _ call ceph_init_dentry (dentry) function to initialize dentry data structure |

Ceph_get_parent (struct dentry * child)

| | _ _ call the ceph_snap () function to check whether child contains snap, and return directly if it contains snap |

| | _ _ call _ _ get_parent () function to obtain the dentry structure of the parent corresponding to child |

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

| | _ _ get struct ceph_mds_client data structure from child |

| | _ _ call the ceph_mdsc_create_request (CEPH_MDS_OP_LOOKUPNAME) function to create a request to find inode name |

| | _ _ call the ceph_mdsc_do_request () function to send the request to the mds cluster synchronously |

| | _ _ call the memcpy () function to copy the dname in the returned information of the request to name |

The above is all the contents of this article "cephfs linux kernel client's operation code for export". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report