函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:lemap_fault - read in file data for page fault handling*@vmf: struct vm_fault containing details of the fault* filemap_fault() is invoked via the vma operations vector for a* mapped memory region to read in file data during a page fault

函数原型:vm_fault_t filemap_fault(struct vm_fault *vmf)

返回类型:vm_fault_t

参数:

类型参数名称
struct vm_fault *vmf
2479  file等于File we map to (can be NULL).
2480  struct file * fpin = NULL
2481  mapping等于f_mapping
2482  ra等于f_ra
2483  inode等于host
2484  offset等于Logical page offset based on vma
2487  ret等于0
2489  max_off等于DIV_ROUND_UP(NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they , PAGE_SIZE)
2490  如果此条件成立可能性小(为编译器优化)(offset >= max_off)则返回:VM_FAULT_SIGBUS
2496  page等于d_get_page - find and get a page reference*@mapping: the address_space to search*@offset: the page index* Looks up the page cache slot at @mapping & @offset. If there is a* page cache page, it is returned with an increased refcount.
2497  如果此条件成立可能性大(为编译器优化)(page)且非FAULT_FLAG_xxx flags 按位与Second try 的值则
2502  fpin等于Asynchronous readahead happens when we find the page and PG_readahead,* so we want to possibly extend the readahead further. We return the file that* was pinned if we have to drop the mmap_sem in order to do IO.
2503  否则如果非page
2505  Disable counters
2506  count_memcg_event_mm(The address space we belong to. , PGMAJFAULT)
2507  ret等于VM_FAULT_MAJOR
2508  fpin等于Synchronous readahead happens when we don't even find a page in the page* cache at all. We don't want to perform IO under the mmap sem, so if we have* to drop the mmap sem we return the file that was pinned in order for us to do* that
2509  retry_find :
2510  page等于pagecache_get_page - find and get a page reference*@mapping: the address_space to search*@offset: the page index*@fgp_flags: PCG flags*@gfp_mask: gfp mask to use for the page cache data page allocation* Looks up the page cache slot at @mapping & @offset.
2513  如果非page
2514  如果fpin则转到:out_retry
2516  返回:vmf_error( - ENOMEM)
2520  如果非lock_page_maybe_drop_mmap - lock the page, possibly dropping the mmap_sem*@vmf - the vm_fault for this fault.*@page - the page to lock.*@fpin - the pointer to the file we may pin (or is already pinned).则转到:out_retry
2524  如果此条件成立可能性小(为编译器优化)( See page-flags.h for PAGE_MAPPING_FLAGS != mapping)则
2525  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
2526  put_page(page)
2527  转到:retry_find
2529  VM_BUG_ON_PAGE(Get the offset in PAGE_SIZE.* (TODO: hugepage should have ->index in PAGE_SIZE) != offset, page)
2535  如果此条件成立可能性小(为编译器优化)(!PageUptodate(page))则转到:page_not_uptodate
2543  如果fpin
2544  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
2545  转到:out_retry
2552  max_off等于DIV_ROUND_UP(NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they , PAGE_SIZE)
2553  如果此条件成立可能性小(为编译器优化)(offset >= max_off)则
2554  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
2555  put_page(page)
2556  返回:VM_FAULT_SIGBUS
2559  ->fault handlers should return a* page here, unless VM_FAULT_NOPAGE* is set (which is also implied by* VM_FAULT_ERROR).等于page
2560  返回:ret按位或VM_FAULT_LOCKED
2562  page_not_uptodate :
2569  ClearPageError(page)
2570  fpin等于maybe_unlock_mmap_for_io(vmf, fpin)
2571  error等于readpage(file, page)
2572  如果非error
2573  Wait for a page to be unlocked.* This must be called with the caller "holding" the page,* ie with increased "page->count" so that the page won't* go away during the wait..
2574  如果非PageUptodate(page)则error等于负EIO
2577  如果fpin则转到:out_retry
2579  put_page(page)
2581  如果非errorerror恒等于AOP_TRUNCATED_PAGE则转到:retry_find
2585  CD/DVDs are error prone. When a medium error occurs, the driver may fail* a _large_ part of the i/o request. Imagine the worst scenario:* ---R__________________________________________B__________* ^ reading here ^ bad block(assume 4k)
2586  返回:VM_FAULT_SIGBUS
2588  out_retry :
2594  如果pageput_page(page)
2596  如果fpinfput(fpin)
2598  返回:ret按位或VM_FAULT_RETRY