In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is to share with you the content of cephfs linux kernel client's sample analysis of the superblock operating process. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Init_caches ()
Initialize the following cache:
Ceph_inode_cachep
Ceph_cap_cachep
Ceph_cap_flush_cachep
Ceph_dentry_cachep
Ceph_file_cachep
Cephfs cache
Ceph_mount ()
| | _ _ parse mount options |
| | _ _ create fs client, that is, struct ceph_fs_client |
| | _ _ create mds client and set the correspondence between fs client and mds client |
| | _ _ gets the superblock and initializes it with the ceph_set_super () function |
| | _ _ call ceph_real_mount () function to perform the actual mount operation |
Ceph_real_mount ()
| | _ _ if the corresponding s_boot in superblock is empty |
| | _ _ call _ _ ceph_open_session () function to create session information from client to mds |
| | _ _ call the open_root_dentry () function to get the root dentry information of cephfs |
| | _ _ write root dentry to s_boot in superblock |
| | _ _ if there is no server path content in mount options |
| | _ _ sets the current root to the s_root for supberblock |
| | _ _ call the dget (root) function to get the dentry information of root |
| | _ _ if there is server path content in mount options |
| | _ _ call open_root_dentry () to get the root dentry information specified by server path |
| | _ _ set mount state to CEPH_MOUNT_MOUNTED |
When initializing superblock with the ceph_set_super () function, set the operation on superblock by setting the following:
S-> s_xattr = ceph_xattr_handlers handles the extended attribute's
S-> s_op = ceph_super_ops for normal operation of superblock
S-> s_export_op = ceph_export_ops that handles export operations against superblock
The type of ceph_super_ops is struct super_operations, which contains a collection of all callback functions for superblock operations.
Ceph_alloc_inode () this function is used to assign inode
| | _ _ get the ceph inode information from the kernel cache, namely: struct ceph_inode_info |
| | _ _ initialize struct ceph_inode_info |
| | _ _ set the kernel thread ceph_writeback_work for the writeback of inode |
| | _ _ set the kernel thread ceph_invalidate_work for the invalidate of inode |
| | _ _ set the kernel thread ceph_vmtruncate_work for the vmtruncate of inode |
| | _ _ returns struct inode information |
Ceph_destroy_inode (struct inode * inode)
| | _ _ call the ceph_fscache_unregister_inode_cookie () function to remove inode from the fscache |
| | _ _ call ceph_queue_caps_release () function to delete all caps in ceph_inode_info |
| | _ _ if ceph _ inode_info contains snap realm information |
| | _ _ call ceph_put_snap_realm () to release snap realm |
| | _ _ release the fragtree information in ceph_inode_info |
| | _ _ call _ _ ceph_destroy_xattrs () function to release all xattrs information in ceph_inode_info |
| | _ _ call the ceph_put_string () function to release the pool_ns information of layout in ceph_inode_info |
Ceph_write_inode (struct inode * inode, struct writeback_control * wbc)
| | _ _ call the try_flush_caps () function to brush all the dirty caps in ceph_inode_info back to the mds cluster |
Ceph_evict_inode (struct inode * inode)
| | _ _ call the ceph_sync_write_wait () function to synchronize all requests on the i_unsafe_writes linked list in ceph_inode_info to the ceph cluster |
| | _ _ call truncate_inode_pages_final () function to release all pages occupied by inode |
| | _ _ call clear_inode () to clear inode information |
Ceph_sync_fs (struct super_block * sb, int wait)
| | _ _ get struct ceph_fs_client information from superblock |
| | _ _ call the ceph_osdc_sync () function to synchronize all struct ceph_osd_request requests on osds with all osdc connections to the ceph cluster |
| | _ _ call the ceph_mdsc_sync () function to brush all the dirty caps in ceph_inode_info back to the mds cluster |
Ceph_put_super (struct super_block * s)
| | _ _ call the ceph_mdsc_close_sessions () function to close all mds sessions |
Ceph_show_options (struct seq_file * m, struct dentry * root)
| | _ _ shows all mount options under / proc/mounts |
Ceph_statfs (struct dentry * dentry, struct kstatfs * buf)
| | _ _ get the struct ceph_fs_client information based on the parameter dentry, namely: fsc=ceph_inode_to_client () |
| | _ _ get struct ceph_monmap information through struct ceph_fs_client |
| | _ _ get all stats information from monitor by calling ceph_monc_do_statfs () |
| | _ _ format the stats information obtained from monitor to buf |
Ceph_umount_begin (struct super_block * sb)
| | _ _ get struct ceph_fs_client information through superblock |
| | _ _ call the ceph_mdsc_force_umount () function to perform a forced umount operation |
| | _ _ query all mds sessions and call _ _ close_session () function to close session |
| | _ _ call the tick_requests () function to send the unsent request to other mds processes |
| | _ _ call _ _ wake_requests () function to send the request on mdsc- > waiting_for_map to other mds processes |
The type of ceph_xattr_handlers is struct xattr_handler, which contains all operations on the xattr of inode.
Ceph_get_xattr_handler (struct xattr_handler * handler, struct dentry * dentry, struct inode * inode, char * name, void * value, size_t size)
| | _ _ call the ceph_is_valid_xattr () function to check whether name is a valid attribute name |
| | _ _ call _ _ ceph_getxattr () function to get the attribute value value corresponding to the attribute name name and the size size of the attribute value value |
| | _ _ check whether name is vxattr. If so, obtain the value corresponding to name directly from vxattr |
| | _ _ call the ceph_do_getattr () function to obtain the xattrs value corresponding to inode from the mds cluster |
| | _ _ call _ _ build_xattrs () function to create xattrs data structure |
| | _ _ call _ _ get_xattr () function to get the value corresponding to name from xattrs |
Ceph_set_xattr_handler (struct xattr_handler * handler, struct dentry * dentry, struct inode * inode, char * name, void * value, size_t size, int flags)
| | _ _ call the ceph_is_valid_xattr () function to check whether name is a valid attribute name |
| | _ _ call _ _ ceph_setxattr () function to set the property name name and attribute value value and synchronize them to the mds cluster |
| | _ _ call _ _ build_xattrs () function to get xattrs data structure |
| | _ _ call _ _ set_xattr () function to write the attribute name name and attribute value value to the red-black tree corresponding to the xattrs of ceph_inode_info |
| | _ _ call _ _ ceph_mark_dirty_caps () function to set caps dirty |
| | _ _ call the ceph_sync_setxattr () function to synchronize the attribute name name and attribute value value corresponding to inode to the mds cluster |
Thank you for reading! This is the end of this article on "cephfs linux kernel client's sample analysis of superblock operation process". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.