cephfs linux kernel client針對fscache的操做

針對inode在fscache中操做主要集中在數據結構struct fscache_cookie_def中,具體的數據結構及其操做以下:node

static const struct fscache_cookie_def ceph_fscache_inode_object_def = {cookie

        .name           = "CEPH.inode",session

        .type           = FSCACHE_COOKIE_TYPE_DATAFILE,數據結構

        .get_key        = ceph_fscache_inode_get_key,app

        .get_attr       = ceph_fscache_inode_get_attr,函數

        .get_aux        = ceph_fscache_inode_get_aux,ui

        .check_aux      = ceph_fscache_inode_check_aux,spa

        .now_uncached   = ceph_fscache_inode_now_uncached,內存

};ci

 

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

相關文章
相關標籤/搜索