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

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

146次閱讀
沒有評論

共計 4344 個字符,預計需要花費 11 分鐘才能閱讀完成。

這篇文章主要為大家展示了“cephfs linux kernel client 針對 fscache 的操作代碼”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓丸趣 TV 小編帶領大家一起研究并學習一下“cephfs linux kernel client 針對 fscache 的操作代碼”這篇文章吧。

針對 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 的操作代碼”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注丸趣 TV 行業資訊頻道!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-08-16發表,共計4344字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 革吉县| 界首市| 汝南县| 南溪县| 胶州市| 白朗县| 桦甸市| 雷州市| 治多县| 德兴市| 乳源| 乃东县| 哈尔滨市| 农安县| 开江县| 万荣县| 孝感市| 萨迦县| 龙泉市| 临湘市| 威远县| 宜兰市| 定兴县| 秭归县| 莱芜市| 潼南县| 揭西县| 西安市| 曲靖市| 航空| 晋城| 新昌县| 龙海市| 丹江口市| 修水县| 淳安县| 墨脱县| 新建县| 庆城县| 濮阳县| 阿坝|