Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\buffer.c Create Date:2022-07-28 20:14:08
Last Modify:2020-03-18 10:38:29 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Create the appropriate buffers when given a page for data area and* the size of each buffer

Proto:struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, bool retry)

Type:struct buffer_head

Parameter:

TypeParameterName
struct page *page
unsigned longsize
boolretry
858  gfp = GFP_NOFS | __GFP_ACCOUNT
862  If retry Then gfp |= __GFP_NOFAIL
865  memcg = get_mem_cgroup_from_page: Obtain a reference on given page's memcg.*@page: page from which memcg should be extracted.* Obtain a reference on page->memcg and returns it if successful. Otherwise* root_mem_cgroup is returned.
866  memalloc_use_memcg - Starts the remote memcg charging scope.*@memcg: memcg to charge.* This function marks the beginning of the remote memcg charging scope. All the* __GFP_ACCOUNT allocations till the end of the scope will be charged to the* given memcg.
868  head = NULL
869  offset = PAGE_SIZE
870  When (offset -= size) >= 0 cycle
871  bh = alloc_buffer_head(gfp)
872  If Not bh Then Go to no_grow
875  circular list of page's buffers = head
876  start block number = -1
877  head = bh
879  size of mapping = size
882  set_bh_page(bh, page, offset)
884  out :
885  memalloc_unuse_memcg - Ends the remote memcg charging scope.* This function marks the end of the remote memcg charging scope started by* memalloc_use_memcg().
886  mem_cgroup_put(memcg)
887  Return head
891  no_grow :
892  If head Then
893  Do
894  bh = head
897  When head cycle
900  Go to out
Caller
NameDescribe
grow_dev_pageCreate the page-cache page that contains the requested block.* This is used purely for blockdev mappings.
create_empty_buffersWe attach and possibly dirty the buffers atomically wrt* __set_page_dirty_buffers() via private_lock. try_to_free_buffers* is already excluded via the page lock.
nobh_write_beginOn entry, the page is fully not uptodate.* On exit the page is fully uptodate in the areas outside (from,to)* The filesystem needs to handle block truncation upon failure.