cephfslinuxkernelclient针对fscache的操作代码

这篇文章主要为大家展示了“cephfs linux kernel client针对fscache的操作代码”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“cephfs linux kernel client针对fscache的操作代码”这篇文章吧。

姑苏网站建设公司成都创新互联公司,姑苏网站设计制作,有大型网站制作公司丰富经验。已为姑苏上1000+提供企业网站建设服务。企业网站搭建\外贸网站制作要多少钱,请找那个售后服务好的姑苏做网站的公司定做!

针对inode在fscache中操作主要集中在数据结构struct fscache_cookie_def中,具体的数据结构及其操作如下:

static const struct fscache_cookie_def ceph_fscache_inode_object_def = {

        .name           = "CEPH.inode",

        .type           = FSCACHE_COOKIE_TYPE_DATAFILE,

        .get_key        = ceph_fscache_inode_get_key,

        .get_attr       = ceph_fscache_inode_get_attr,

        .get_aux        = ceph_fscache_inode_get_aux,

        .check_aux      = ceph_fscache_inode_check_aux,

        .now_uncached   = ceph_fscache_inode_now_uncached,

};

ceph_fscache_inode_get_key(void *cookie_netfs_data, void *buffer, uint16_t maxbuf)    读取struct ceph_inode_info中的i_vino信息到buffer

|__从参数cookie_netfs_data的到struct ceph_inode_info数据结构

|__调用memcpy()将struct ceph_inode_info中的i_vino内容复制到buffer中

ceph_fscache_inode_get_attr(void *cookie_netfs_data, uint64_t *size)    读取struct ceph_inode_info中vfs_inode的大小

|__从参数cookie_netfs_data的到struct ceph_inode_info数据结构

|__调用i_size_read()函数读取struct ceph_inode_info中vfs_inode的大小且保存到size中

ceph_fscache_inode_get_aux(void *cookie_netfs_data, void *buffer, uint16_t bufmax)

|__从参数cookie_netfs_data的到struct ceph_inode_info数据结构

|__初始化struct ceph_aux_inode信息

|__从struct ceph_inode_info结构中初始化struct ceph_aux_inode信息

|__将struct ceph_aux_inode信息复制到buffer中

ceph_fscache_inode_check_aux(void *cookie_netfs_data, void *data, uint16_t dlen)

|__从参数cookie_netfs_data的到struct ceph_inode_info数据结构

|__从struct ceph_inode_info结构中初始化struct ceph_aux_inode信息

|__比较参数中的data和初始化后的struct ceph_aux_inode信息

ceph_fscache_inode_now_uncached(void *cookie_netfs_data)

|__从参数cookie_netfs_data的到struct ceph_inode_info数据结构

|__调用pagevec_init()函数初始化pvec

|__调用pagevec_lookup()函数查找struct ceph_inode_info里vfs_inode.i_mapping里所有映射的物理内存页

|__调用ClearPageFsCache()函数清除物理内存页的fscache

|__调用pagevec_release()函数释放pvec

ceph_fscache_register_inode_cookie(struct inode *inode)

|__从参数inode中得到struct ceph_inode_info以及struct ceph_fs_client信息

|__调用fscache_acquire_cookie()函数得到访问ceph fscache的cookie值且将该cookie值保存到struct ceph_inode_info的fscache中

ceph_fscache_unregister_inode_cookie(struct ceph_inode_info *ci)

|__调用fscache_uncache_all_inode_pages()函数从cache中删除所有inode占用的物理内存页

|__调用fscache_relinquish_cookie()函数删除cookie

ceph_fscache_can_enable(void *data)

|__从参数data中得到struct inode数据结构

|__调用inode_is_open_for_write(inode)函数且返回该函数返回值的非

ceph_fscache_file_set_cookie(struct inode *inode, struct file *filp)

|__从参数inode得到struct ceph_inode_info数据结构

|__调用fscache_cookie_valid()函数检查struct ceph_inode_info中的fscache是否有效,若无效则直接返回

|__调用inode_is_open_for_write()函数检查inode是打开并可写

    |__调用fscache_disable_cookie()函数禁用cookie

    |__调用fscache_uncache_all_inode_pages()函数删除掉cache中inode的所有物理内存页

|__调用inode_is_open_for_write()函数检查inode是未打开且不可写

    |__调用fscache_enable_cookie()函数启用cookie

ceph_fscache_register()

|__调用fscache_register_netfs()函数注册ceph的fscache

ceph_fscache_unregister()

|__调用fscache_unregister_netfs()函数注销ceph的fscache

ceph_fscache_register_fs(struct ceph_fs_client *fs)

|__调用fscache_acquire_cookie()函数得到访问ceph fscache的cookie值且将该cookie值保存到struct ceph_fs_client的fscache中

ceph_fscache_unregister_fs(struct ceph_fs_client *fsc)

|__调用fscache_relinquish_cookie()函数释放fsc->fscache数据结构

ceph_fscache_session_get_key(void *cookie_netfs_data, void *buffer, uint16_t maxbuf)

|__从参数cookie_netfs_data的到struct ceph_fs_client数据结构

|__调用memcpy()函数将struct ceph_fs_client数据结构中的client->fsid值复制到buffer中

ceph_readpage_from_fscache(struct inode *inode, struct page *page)

|__从参数inode得到struct ceph_inode_info数据结构

|__调用fscache_read_or_alloc_page()函数从fscache中读取inode的内容并写到page中

ceph_readpages_from_fscache(struct inode *inode, struct address_space *mapping, struct list_head *pages, unsigned *nr_pages)

|__从参数inode得到struct ceph_inode_info数据结构

|__调用fscache_read_or_alloc_pages()函数从fscahe中读取mapping中的数据并写入到pages中

ceph_readpage_to_fscache(struct inode *inode, struct page *page)

|__从参数inode得到struct ceph_inode_info数据结构

|__调用fscache_write_page()函数将物理内存页page中的数据同步到fscache中

ceph_invalidate_fscache_page(struct inode *inode, struct page *page)

|__从参数inode得到struct ceph_inode_info数据结构

|__调用fscache_wait_on_page_write()函数等待page写入完成

|__调用fscache_uncache_page()函数将page中的内容从struct ceph_inode_info中的fscache中删除

ceph_fscache_revalidate_cookie(struct ceph_inode_info *ci)

|__调用cache_valid()函数检查ci指定的fscache是否有效,若无效

    |__调用fscache_check_consistency()函数校验ci->fscache的一致性,若不一致

        |__调用fscache_invalidate()函数设置ci->fscache无效

    |__设置ci->i_fscache_gen=ci->i_rdcache_gen

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


当前文章:cephfslinuxkernelclient针对fscache的操作代码
网页地址:http://bzwzjz.com/article/pgpjgd.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站建设推广 成都网站建设 网站制作 成都h5网站建设 定制网站建设多少钱 手机网站制作 成都网站设计 定制网站建设 网站设计制作 网站建设 成都网站建设 成都网站制作 成都网站建设 高端定制网站设计 成都营销网站建设 重庆网站建设 营销型网站建设 响应式网站设计 网站制作公司 成都商城网站建设 定制网站制作 响应式网站建设