Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\filemap.c Create Date:2022-07-28 14:01:18
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__add_to_page_cache_locked

Proto:static int __add_to_page_cache_locked(struct page *page, struct address_space *mapping, unsigned long offset, gfp_t gfp_mask, void **shadowp)

Type:int

Parameter:

TypeParameterName
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  If Not huge Then
866  error = mem_cgroup_try_charge(page, mm, gfp_mask, & memcg, false)
868  If error Then Return error
872  get_page(page)
873  See page-flags.h for PAGE_MAPPING_FLAGS = mapping
874  Our offset within mapping. = offset
876  Do
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  If old && Not 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. Then 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  If 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. Then Go to unlock
886  nrexceptional--
887  If shadowp Then shadowp = old
890  nrpages++
893  If Not huge Then __inc_node_page_state(page, NR_FILE_PAGES)
895  unlock :
896  xas_unlock_irq( & xas)
897  When 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. cycle
899  If 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. Then Go to error
902  If Not huge Then mem_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  Return 0
906  error :
907  See page-flags.h for PAGE_MAPPING_FLAGS = NULL
909  If Not huge Then mem_cgroup_cancel_charge(page, memcg, false)
911  put_page(page)
912  Return 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.
Caller
NameDescribe
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