函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:On 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.

函数原型:int nobh_write_begin(struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata, get_block_t *get_block)

返回类型:int

参数:

类型参数名称
struct address_space *mapping
loff_tpos
unsignedlen
unsignedflags
struct page **pagep
void **fsdata
get_block_t *get_block
2579  inode等于host
2580  blkbits等于i_blkbits
2581  blocksize等于1左移blkbits
2589  nr_reads等于0
2590  ret等于0
2591  is_mapped_to_disk等于1
2593  index等于pos右移PAGE_SHIFT determines the page size
2594  from等于pos按位与PAGE_SIZE减1
2595  to等于fromlen
2597  page等于Find or create a page at the given pagecache position. Return the locked* page. This function is specifically for buffered writes.
2598  如果非page则返回:负ENOMEM
2600  pagep等于page
2601  * fsdata = NULL
2603  如果page_has_buffers(page)则
2604  ret等于__block_write_begin(page, pos, len, get_block)
2605  如果此条件成立可能性小(为编译器优化)(ret)则转到:out_release
2607  返回:ret
2610  如果PageMappedToDisk(page)则返回:0
2622  head等于Create the appropriate buffers when given a page for data area and* the size of each buffer
2623  如果非head
2624  ret等于负ENOMEM
2625  转到:out_release
2628  block_in_file等于 Our offset within mapping. 左移PAGE_SHIFT determines the page size blkbits
2635 block_start小于PAGE_SIZE循环
2640  block_end等于block_startblocksize
2641  buffer state bitmap (see above) 等于0
2642  create等于1
2643  如果block_start大于等于tocreate等于0
2645  ret等于get_block(inode, block_in_file + block_in_page, bh, create)
2647  如果ret则转到:failed
2649  如果非buffer_mapped(bh)则is_mapped_to_disk等于0
2651  如果buffer_new(bh)则clean_bdev_bh_alias(bh)
2653  如果PageUptodate(page)则
2655  继续下一循环
2657  如果buffer_new(bh)或非buffer_mapped(bh)则
2660  继续下一循环
2662  如果Emit the buffer bitops functions. Note that there are also functions* of the form "mark_buffer_foo()". These are higher-level functions which* do something in addition to setting a b_state bit.则继续下一循环
2664  如果block_start小于fromblock_end大于to
2665  lock_buffer(bh)
2667  submit_bh(REQ_OP_READ, 0, bh)
2668  nr_reads自加
2672  如果nr_reads
2678 bh循环
2679  wait_on_buffer(bh)
2683  如果ret则转到:failed
2687  如果is_mapped_to_diskSetPageMappedToDisk(page)
2690  fsdata等于head
2692  返回:0
2694  failed :
2695  BUG_ON(!ret)
2703  Attach the singly-linked list of buffers created by nobh_write_begin, to* the page (converting it to circular linked list and taking care of page* dirty races).
2704  If a page has any new buffers, zero them out here, and mark them uptodate* and dirty so they'll be written out (in order to prevent uninitialised* block data from leaking). And clear the new bit.
2706  out_release :
2707  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.
2708  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
2709  * pagep = NULL
2711  返回:ret