Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:An autonomous function to put a chunk of a page under deferred IO.* The caller doesn't actually know (or care) whether this piece of page is in* a BIO, or is under IO or whatever. We just take care of all possible * situations here

Proto:static inline int submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, unsigned offset, unsigned len, sector_t blocknr, struct buffer_head *map_bh)

Type:int

Parameter:

TypeParameterName
struct dio *dio
struct dio_submit *sdio
struct page *page
unsignedoffset
unsignedlen
sector_tblocknr
struct buffer_head *map_bh
831  ret = 0
833  If op == REQ_OP_WRITE Then
837  task_io_account_write(len)
843  If The page == page && Offset into it, in bytes + Nr of bytes at cur_page_offset == offset && Where it starts + (Nr of bytes at cur_page_offset >> doesn't change ) == blocknr Then
847  Nr of bytes at cur_page_offset += len
848  Go to out
854  If The page Then
855  ret = Put cur_page under IO
856  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
857  The page = NULL
858  If ret Then Return ret
862  get_page(page)
863  The page = page
864  Offset into it, in bytes = offset
865  Nr of bytes at cur_page_offset = len
866  Where it starts = blocknr
867  Offset in file = Current offset into the underlyingfile in dio_block units. << doesn't change
868  out :
873  If prev block is at a boundary Then
874  ret = Put cur_page under IO
875  If under assembly Then In the AIO read case we speculatively dirty the pages before starting IO.* During IO completion, any of these pages which happen to have been written* back will be redirtied by bio_check_pages_dirty().
877  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
878  The page = NULL
880  Return ret
Caller
NameDescribe
dio_zero_blockIf we are not writing the entire block and get_block() allocated* the block for us, we need to fill-in the unused portion of the* block with zeros
do_direct_IOWalk the user pages, and the file, mapping blocks to disk and generating* a sequence of (page,offset,len,block) mappings. These mappings are injected* into submit_page_section(), which takes care of the next stage of submission