函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\truncate.c Create Date:2022-07-27 15:38:19
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

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

函数原型:void truncate_inode_pages_range(struct address_space *mapping, loff_t lstart, loff_t lend)

返回类型:void

参数:

类型参数名称
struct address_space *mapping
loff_tlstart
loff_tlend
303  如果nrpages恒等于0且nrexceptional恒等于0则转到:out
307  partial_start等于lstart按位与PAGE_SIZE减1
308  partial_end等于lend加1按位与PAGE_SIZE减1
316  start等于lstartPAGE_SIZE减1右移PAGE_SHIFT determines the page size
317  如果lend恒等于负1则end等于负1
324  否则end等于lend加1右移PAGE_SHIFT determines the page size
327  pagevec_init( & pvec)
328  index等于start
329 index小于endpagevec_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 循环
339  pagevec_init( & locked_pvec)
340 i小于pagevec_count( & pvec)循环
341  page等于pages[i]
344  index等于indices[i]
345  如果index大于等于end退出
351  如果非Return true if the page was successfully locked则继续下一循环
364 i小于pagevec_count( & locked_pvec)循环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 i小于pagevec_count( & locked_pvec)循环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  如果partial_start
375  page等于d_lock_page - locate, pin and lock a pagecache page*@mapping: the address_space to search*@offset: the page index* Looks up the page cache slot at @mapping & @offset. If there is a* page cache page, it is returned locked and with an increased* refcount.
376  如果page
377  top等于PAGE_SIZE
378  如果start大于end
380  top等于partial_end
381  partial_end等于0
390  put_page(page)
393  如果partial_end
394  page等于d_lock_page - locate, pin and lock a pagecache page*@mapping: the address_space to search*@offset: the page index* Looks up the page cache slot at @mapping & @offset. If there is a* page cache page, it is returned locked and with an increased* refcount.
395  如果page
403  put_page(page)
410  如果start大于等于end则转到:out
413  index等于start
414  循环
415  cond_resched()
419  如果index恒等于start退出
422  index等于start
423  继续下一循环
425  如果index恒等于startindices[0]大于等于end
428  pagevec_release( & pvec)
429  退出
432 i小于pagevec_count( & pvec)循环
433  page等于pages[i]
436  index等于indices[i]
437  如果index大于等于end
439  index等于start减1
440  退出
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)
调用者
名称描述
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
blk_ioctl_discard
blkdev_fallocate