Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__swap_writepage

Proto:int __swap_writepage(struct page *page, struct writeback_control *wbc, bio_end_io_t end_write_func)

Type:int

Parameter:

TypeParameterName
struct page *page
struct writeback_control *wbc
bio_end_io_tend_write_func
283  sis = page_swap_info(page)
285  VM_BUG_ON_PAGE(!PageSwapCache(page), page)
286  If SWP_USED etc: see above & SWP_FS Then
288  swap_file = seldom referenced
289  mapping = f_mapping
290  struct bio_vec bv = {bv_page = page, bv_len = PAGE_SIZE, bv_offset = 0}
297  iov_iter_bvec( & from, WRITE, & bv, 1, PAGE_SIZE)
298  init_sync_kiocb( & kiocb, swap_file)
299  The 'ki_filp' pointer is shared in a union for aio = page_file_offset(page)
301  set_page_writeback(page)
302  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.
303  ret = direct_IO( & kiocb, & from)
304  If ret == PAGE_SIZE Then
306  ret = 0
307  Else
318  Dirty a page
320  pr_err_ratelimited("Write error on dio swapfile (%llu)\n", page_file_offset(page))
323  d_page_writeback - end writeback against a page*@page: the page
324  Return ret
327  ret = dev_write_page() - Start writing a page to a block device*@bdev: The device to write the page to*@sector: The offset on the device to write the page to (need not be aligned)*@page: The page to write*@wbc: The writeback_control for the write
328  If Not ret Then
329  count_swpout_vm_event(page)
330  Return 0
333  ret = 0
334  bio = get_swap_bio(GFP_NOIO, page, end_write_func)
335  If (bio == NULL) Then
336  Dirty a page
337  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.
338  ret = -ENOMEM
339  Go to out
341  bottom bits req flags, * top bits REQ_OP. Use * accessors. = REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc)
342  bio_associate_blkg_from_page(bio, page)
343  count_swpout_vm_event(page)
344  set_page_writeback(page)
345  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.
346  submit_bio(bio)
347  out :
348  Return ret
Caller
NameDescribe
swap_writepageWe may have stale swap cache pages in memory: notice* them here and get rid of the unnecessary final write.
zswap_writeback_entry