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:nobh_truncate_page

Proto:int nobh_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
2805  index = from >> PAGE_SHIFT determines the page size
2806  offset = from & PAGE_SIZE - 1
2810  inode = host
2815  blocksize = i_blocksize(inode)
2816  length = offset & blocksize - 1
2819  If Not length Then Return 0
2822  length = blocksize - length
2823  iblock = index << PAGE_SHIFT determines the page size - i_blkbits
2825  page = Returns locked page at given index in given cache, creating it if needed.
2826  err = -ENOMEM
2827  If Not page Then Go to out
2830  If page_has_buffers(page) Then
2831  has_buffers :
2832  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.
2833  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
2834  Return block_truncate_page(mapping, from, get_block)
2838  pos = blocksize
2839  When offset >= pos cycle
2840  iblock++
2841  pos += blocksize
2844  size of mapping = blocksize
2845  buffer state bitmap (see above) = 0
2846  err = get_block(inode, iblock, & map_bh, 0)
2847  If err Then Go to unlock
2850  If Not buffer_mapped( & map_bh) Then Go to unlock
2854  If Not PageUptodate(page) Then
2855  err = readpage(NULL, page)
2856  If err Then
2858  Go to out
2860  lock_page may only be called if we have the page's inode pinned.
2861  If Not PageUptodate(page) Then
2862  err = -EIO
2863  Go to unlock
2865  If page_has_buffers(page) Then Go to has_buffers
2868  zero_user(page, offset, length)
2869  Dirty a page
2870  err = 0
2872  unlock :
2873  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.
2874  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
2875  out :
2876  Return err