Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\truncate.c Create Date:2022-07-28 14:14:32
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:runcate_inode_pages_range - truncate range of pages specified by start & end byte offsets*@mapping: mapping to truncate*@lstart: offset from which to truncate*@lend: offset to which to truncate (inclusive)* Truncate the page cache, removing the pages that

Proto:void truncate_inode_pages_range(struct address_space *mapping, loff_t lstart, loff_t lend)

Type:void

Parameter:

TypeParameterName
struct address_space *mapping
loff_tlstart
loff_tlend
303  If nrpages == 0 && nrexceptional == 0 Then Go to out
307  partial_start = lstart & PAGE_SIZE - 1
308  partial_end = lend + 1 & PAGE_SIZE - 1
316  start = lstart + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
317  If lend == -1 Then end = -1
324  Else end = lend + 1 >> PAGE_SHIFT determines the page size
327  pagevec_init( & pvec)
328  index = start
329  When index < end && pagevec_lookup_entries - gang pagecache lookup*@pvec: Where the resulting entries are placed*@mapping: The address_space to search*@start: The starting entry index*@nr_entries: The maximum number of pages*@indices: The cache indices corresponding to the cycle
339  pagevec_init( & locked_pvec)
340  When i < pagevec_count( & pvec) cycle
341  page = pages[i]
344  index = indices[i]
345  If index >= end Then Break
364  When i < pagevec_count( & locked_pvec) cycle If truncate cannot remove the fs-private metadata from the page, the page* becomes orphaned
366  delete_from_page_cache_batch(mapping, & locked_pvec)
367  When i < pagevec_count( & locked_pvec) cycle 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.
369  Unconditionally remove exceptional entries. Usually called from truncate* path. Note that the pagevec may be altered by this function by removing* exceptional entries similar to what pagevec_remove_exceptionals does.
370  pagevec_release( & pvec)
371  cond_resched()
372  index++
374  If partial_start Then
375  page = locate, pin and lock a pagecache page
376  If page Then
377  top = PAGE_SIZE
378  If start > end Then
380  top = partial_end
381  partial_end = 0
390  put_page(page)
393  If partial_end Then
394  page = locate, pin and lock a pagecache page
395  If page Then
403  put_page(page)
410  If start >= end Then Go to out
413  index = start
414  cycle
415  cond_resched()
419  If index == start Then Break
422  index = start
423  Continue
425  If index == start && indices[0] >= end Then
428  pagevec_release( & pvec)
429  Break
432  When i < pagevec_count( & pvec) cycle
433  page = pages[i]
436  index = indices[i]
437  If index >= end Then
439  index = start - 1
440  Break
452  Unconditionally remove exceptional entries. Usually called from truncate* path. Note that the pagevec may be altered by this function by removing* exceptional entries similar to what pagevec_remove_exceptionals does.
453  pagevec_release( & pvec)
454  index++
457  out :
458  cleancache_invalidate_inode(mapping)
Caller
NameDescribe
truncate_inode_pagesruncate_inode_pages - truncate *all* the pages from an offset*@mapping: mapping to truncate*@lstart: offset from which to truncate* Called under (and serialised by) inode->i_mutex.* Note: When this function returns, there can be a page in the process of
truncate_pagecache_rangeruncate_pagecache_range - unmap and remove pagecache that is hole-punched*@inode: inode*@lstart: offset of beginning of hole*@lend: offset of last byte of hole* This function should typically be called before the filesystem
shmem_truncate_range
blk_ioctl_zeroout