函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\buffer.c Create Date:2022-07-29 10:45:15
Last Modify:2020-03-18 10:38:29 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:While block_write_full_page is writing back the dirty buffers under* the page lock, whoever dirtied the buffers may decide to clean them* again at any time

函数原型:int __block_write_full_page(struct inode *inode, struct page *page, get_block_t *get_block, struct writeback_control *wbc, bh_end_io_t *handler)

返回类型:int

参数:

类型参数名称
struct inode *inode
struct page *page
get_block_t *get_block
struct writeback_control *wbc
bh_end_io_t *handler
1718  nr_underway等于0
1719  write_flags等于wbc_to_write_flags(wbc)
1721  head等于create_page_buffers(page, inode, (1 << BH_Dirty) | (1 << BH_Uptodate))
1734  bh等于head
1735  blocksize等于 size of mapping
1736  bbits等于Size is a power-of-two in the range 512..PAGE_SIZE,* and the case we care about most is PAGE_SIZE.* So this *could* possibly be written with those* constraints in mind (relevant mostly if some* architecture has a slow bit-scan instruction)
1738  block等于 Our offset within mapping. 左移PAGE_SHIFT determines the page size bbits
1739  last_block等于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 减1右移bbits
1745  循环
1746  如果block大于last_block
1757  否则如果非buffer_mapped(bh)或buffer_delay(bh)的值且buffer_dirty(bh)则
1760  err等于get_block(inode, block, bh, 1)
1761  如果err则转到:recover
1764  如果buffer_new(bh)则
1770  bh等于 circular list of page's buffers
1771  block自加
1772 bh不等于head循环
1774  循环
1775  如果非buffer_mapped(bh)则继续下一循环
1784  如果sync_mode不等于Don't wait on anything
1785  lock_buffer(bh)
1786  否则如果非trylock_buffer(bh)则
1788  继续下一循环
1790  如果test_clear_buffer_dirty(bh)则
1792  否则
1793  unlock_buffer(bh)
1795 bh等于 circular list of page's buffers 不等于head循环
1801  BUG_ON(Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting.)
1802  set_page_writeback(page)
1804  循环
1805  next等于 circular list of page's buffers
1806  如果buffer_async_write(bh)则
1809  nr_underway自加
1811  bh等于next
1812 bh不等于head循环
1813  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.
1815  err等于0
1816  done :
1817  如果nr_underway恒等于0则
1823  d_page_writeback - end writeback against a page*@page: the page
1830  返回:err
1832  recover :
1839  bh等于head
1841  循环
1842  如果buffer_mapped(bh)且buffer_dirty(bh)且非buffer_delay(bh)则
1844  lock_buffer(bh)
1846  否则
1853 bh等于 circular list of page's buffers 不等于head循环
1854  SetPageError(page)
1855  BUG_ON(Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting.)
1856  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
1857  set_page_writeback(page)
1858  循环
1859  next等于 circular list of page's buffers
1860  如果buffer_async_write(bh)则
1864  nr_underway自加
1866  bh等于next
1867 bh不等于head循环
1868  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.
1869  转到:done
调用者
名称描述
nobh_writepagebh_writepage() - based on block_full_write_page() except* that it tries to operate without attaching bufferheads to* the page.
block_write_full_pageThe generic ->writepage function for buffer-backed address_spaces