函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:We implement an immediate ioend submission policy here to avoid needing to* chain multiple ioends and hence nest mempool allocations which can violate* forward progress guarantees we need to provide

函数原型:static int iomap_writepage_map(struct iomap_writepage_ctx *wpc, struct writeback_control *wbc, struct inode *inode, struct page *page, u64 end_offset)

返回类型:int

参数:

类型参数名称
struct iomap_writepage_ctx *wpc
struct writeback_control *wbc
struct inode *inode
struct page *page
u64end_offset
1416  iop等于to_iomap_page(page)
1418  len等于i_blocksize(inode)
1420  error等于0, count等于0
1421  LIST_HEAD(submit_list)
1423  WARN_ON_ONCE(i_blocksize(inode) < PAGE_SIZE && !iop)
1424  WARN_ON_ONCE(iop && atomic_read( & write_count) != 0)
1431 i小于PAGE_SIZE右移i_blkbits位且file_offset小于end_offset循环
1434  如果iop且非st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from则继续下一循环
1437  error等于map_blocks(wpc, inode, file_offset)
1438  如果error退出
1440  如果WARN_ON_ONCE( type of mapping == data inline in the inode )则继续下一循环
1442  如果 type of mapping 恒等于 blocks allocated, need allocation 则继续下一循环
1444  Test to see if we have an existing ioend structure that we could append to* first, otherwise finish off the current ioend and start another.
1446  count自加
1449  WARN_ON_ONCE(!ioend && !链表为空)
1450  WARN_ON_ONCE(!PageLocked(page))
1451  WARN_ON_ONCE(Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting.)
1459  如果此条件成立可能性小(为编译器优化)(error)则
1460  如果非count
1466  如果discard_pagediscard_page(page)
1470  转到:done
1481  set_page_writeback_keepwrite(page)
1482  否则
1483  Clear a page's dirty flag, while caring for dirty memory accounting.* Returns true if the page was previously dirty.* This is for preparing to put the page under writeout. We leave the page* tagged as dirty in the xarray so that a concurrent write-for-sync
1484  set_page_writeback(page)
1487  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.
1497  删除链表项并重新初始化
1498  error2等于Submit the final bio for an ioend.* If @error is non-zero, it means that we have a situation where some part of* the submission process has failed after we have marked paged for writeback* and unlocked them
1499  如果error2且非errorerror等于error2
1507  如果非countd_page_writeback - end writeback against a page*@page: the page
1509  done :
1510  mapping_set_error - record a writeback error in the address_space*@mapping - the mapping in which an error should be set*@error - the error to set in the mapping* When writeback fails in some way, we must record that error so that
1511  返回:error
调用者
名称描述
iomap_do_writepageWrite out a dirty page.* For delalloc space on the page we need to allocate space and flush it.* For unwritten space on the page we need to start the conversion to* regular allocated space.