函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\ramfs\file-nommu.c Create Date:2022-07-29 11:11:52
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:add a contiguous set of pages into a ramfs inode when it's truncated from* size 0 on the assumption that it's going to be used for an mmap of shared* memory

函数原型:int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)

返回类型:int

参数:

类型参数名称
struct inode *inode
size_tnewsize
69  gfp等于mapping_gfp_mask(i_mapping)
72  order等于get_order - Determine the allocation order of a memory size*@size: The size for which to get the order* Determine the allocation order of a particular sized block of memory
73  如果此条件成立可能性小(为编译器优化)(order >= Free memory management - zoned buddy allocator. )则返回:负EFBIG
76  ret等于de_newsize_ok - may this inode be truncated to a given size*@inode: the inode to be truncated*@offset: the new size to assign to the inode* inode_newsize_ok must be called with i_mutex held
77  如果ret则返回:ret
80  NOTE: unlike i_size_read(), i_size_write() does need locking around it* (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount* can be lost, resulting in subsequent i_size_read() calls spinning forever.
84  pages等于alloc_pages(gfp, order)
85  如果非pages则返回:负ENOMEM
89  xpages等于1UL左移order
90  npages等于newsizePAGE_SIZE减1右移PAGE_SHIFT determines the page size
92  split_page takes a non-compound higher-order page, and splits it into* n (1<
95 loop小于xpages循环__free_page(pages + loop)
99  newsize等于PAGE_SIZEnpages
100  data等于page_address(pages)
101  memset(data, 0, newsize)
104 loop小于npages循环
105  page等于pagesloop
107  ret等于add_to_page_cache_lru(page, i_mapping, loop, gfp)
109  如果ret小于0则转到:add_error
113  SetPageDirty(page)
114  SetPageUptodate(page)
116  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.
117  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
120  返回:0
122  add_error :
123 loop小于npages循环
124  __free_page(pages + loop++)
125  返回:ret
调用者
名称描述
ramfs_nommu_resize
__shmem_file_setupmmon code