Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:block_truncate_page

Proto:int block_truncate_page(struct address_space *mapping, loff_t from, get_block_t *get_block)

Type:int

Parameter:

TypeParameterName
struct address_space *mapping
loff_tfrom
get_block_t *get_block
2883  index = from >> PAGE_SHIFT determines the page size
2884  offset = from & PAGE_SIZE - 1
2888  inode = host
2893  blocksize = i_blocksize(inode)
2894  length = offset & blocksize - 1
2897  If Not length Then Return 0
2900  length = blocksize - length
2901  iblock = index << PAGE_SHIFT determines the page size - i_blkbits
2903  page = Returns locked page at given index in given cache, creating it if needed.
2904  err = -ENOMEM
2905  If Not page Then Go to out
2908  If Not page_has_buffers(page) Then We 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.
2912  bh = If we *know* page->private refers to buffer_heads (page)
2913  pos = blocksize
2914  When offset >= pos cycle
2915  bh = circular list of page's buffers
2916  iblock++
2917  pos += blocksize
2920  err = 0
2921  If Not buffer_mapped(bh) Then
2922  WARN_ON( size of mapping != blocksize)
2923  err = get_block(inode, iblock, bh, 0)
2924  If err Then Go to unlock
2927  If Not buffer_mapped(bh) Then Go to unlock
2932  If PageUptodate(page) Then 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.
2935  If Not 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. && Not buffer_delay(bh) && Not buffer_unwritten(bh) Then
2936  err = -EIO
2937  ll_rw_block: low-level access to block devices (DEPRECATED)*@op: whether to %READ or %WRITE*@op_flags: req_flag_bits*@nr: number of &struct buffer_heads in the array*@bhs: array of pointers to &struct buffer_head* ll_rw_block() takes an array of pointers
2938  wait_on_buffer(bh)
2940  If Not 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. Then Go to unlock
2944  zero_user(page, offset, length)
2945  mark_buffer_dirty - mark a buffer_head as needing writeout*@bh: the buffer_head to mark dirty* mark_buffer_dirty() will set the dirty bit against the buffer, then set* its backing page dirty, then tag the page as dirty in the page cache* and then attach
2946  err = 0
2948  unlock :
2949  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.
2950  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
2951  out :
2952  Return err
Caller
NameDescribe
nobh_truncate_page