Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:aio_migratepage

Proto:static int aio_migratepage(struct address_space *mapping, struct page *new, struct page *old, enum migrate_mode mode)

Type:int

Parameter:

TypeParameterName
struct address_space *mapping
struct page *new
struct page *old
enum migrate_modemode
389  If mode == MIGRATE_SYNC_NO_COPY Then Return -EINVAL
392  rc = 0
395  spin_lock( & private_lock)
396  ctx = private_data
397  If Not ctx Then
398  rc = -EINVAL
399  Go to out
406  If Not mutex_trylock - try to acquire the mutex, without waiting*@lock: the mutex to be acquired* Try to acquire the mutex atomically Then
407  rc = -EAGAIN
408  Go to out
411  idx = Our offset within mapping.
412  If idx < nr_pages Then
414  If ring_pages[idx] != old Then rc = -EAGAIN
416  Else rc = -EINVAL
419  If rc != 0 Then Go to out_unlock
423  BUG_ON(Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting.)
424  get_page(new)
426  rc = Replace the page in the mapping.* The number of remaining references must be:* 1 for anonymous pages without a mapping* 2 for pages with a mapping* 3 for pages with a mapping and PagePrivate/PagePrivate2 set.
427  If rc != Return values from addresss_space_operations.migratepage():* - negative errno on page migration failure;* - zero on page migration success; Then
428  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
429  Go to out_unlock
436  spin_lock_irqsave( & completion_lock, flags)
437  migrate_page_copy(new, old)
438  BUG_ON(ring_pages[idx] != old)
439  ring_pages[idx] = new
440  spin_unlock_irqrestore( & completion_lock, flags)
443  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
445  out_unlock :
446  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
447  out :
448  spin_unlock( & private_lock)
449  Return rc