函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\filemap.c Create Date:2022-07-27 15:24:07
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__add_to_page_cache_locked

函数原型:static int __add_to_page_cache_locked(struct page *page, struct address_space *mapping, unsigned long offset, gfp_t gfp_mask, void **shadowp)

返回类型:int

参数:

类型参数名称
struct page *page
struct address_space *mapping
unsigned longoffset
gfp_tgfp_mask
void **shadowp
855  XA_STATE() - Declare an XArray operation state.*@name: Name of this operation state (usually xas).*@array: Array to operate on.*@index: Initial index of interest.* Declare and initialise an xa_state on the stack.(xas, & i_pages, offset)
856  huge等于PageHuge(page)
861  VM_BUG_ON_PAGE(!PageLocked(page), page)
862  VM_BUG_ON_PAGE(PageSwapBacked(page), page)
863  mapping_set_update( & xas, mapping)
865  如果非huge
866  error等于mem_cgroup_try_charge(page, mm, gfp_mask, & memcg, false)
868  如果error则返回:error
872  get_page(page)
873  See page-flags.h for PAGE_MAPPING_FLAGS 等于mapping
874  Our offset within mapping. 等于offset
876  循环
877  xas_lock_irq( & xas)
878  old等于xas_load() - Load an entry from the XArray (advanced).*@xas: XArray operation state.* Usually walks the @xas to the appropriate state to load the entry* stored at xa_index. However, it will do nothing and return %NULL if*@xas is in an error state
879  如果old且非xa_is_value() - Determine if an entry is a value.*@entry: XArray entry.* Context: Any context.* Return: True if the entry is a value, false if it is a pointer.xas_set_err() - Note an error in the xa_state.*@xas: XArray operation state.*@err: Negative error number.* Only call this function with a negative @err; zero or positive errors* will probably not behave the way you think they should. If you want
881  xas_store() - Store this entry in the XArray
882  如果xas_error() - Return an errno stored in the xa_state.*@xas: XArray operation state.* Return: 0 if no error has been noted. A negative errno if one has.则转到:unlock
886  nrexceptional自减
887  如果shadowpshadowp等于old
890  nrpages自加
893  如果非huge__inc_node_page_state(page, NR_FILE_PAGES)
895  unlock :
896  xas_unlock_irq( & xas)
897 xas_nomem() - Allocate memory if needed.*@xas: XArray operation state.*@gfp: Memory allocation flags.* If we need to add new nodes to the XArray, we try to allocate memory* with GFP_NOWAIT while holding the lock, which will usually succeed.循环
899  如果xas_error() - Return an errno stored in the xa_state.*@xas: XArray operation state.* Return: 0 if no error has been noted. A negative errno if one has.则转到:error
902  如果非hugemem_cgroup_commit_charge(page, memcg, TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., false)
904  trace_mm_filemap_add_to_page_cache(page)
905  返回:0
906  error :
907  See page-flags.h for PAGE_MAPPING_FLAGS = NULL
909  如果非hugemem_cgroup_cancel_charge(page, memcg, false)
911  put_page(page)
912  返回:xas_error() - Return an errno stored in the xa_state.*@xas: XArray operation state.* Return: 0 if no error has been noted. A negative errno if one has.
调用者
名称描述
add_to_page_cache_lockedadd_to_page_cache_locked - add a locked page to the pagecache*@page: page to add*@mapping: the page's address_space*@offset: page index*@gfp_mask: page allocation mode* This function is used to add a page to the pagecache. It must be locked.
add_to_page_cache_lru