Function report |
Source Code:mm\migrate.c |
Create Date:2022-07-28 15:58:48 |
| Last Modify:2022-05-20 09:53:13 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:__buffer_migrate_page
Proto:static int __buffer_migrate_page(struct address_space *mapping, struct page *newpage, struct page *page, enum migrate_mode mode, bool check_refs)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct address_space * | mapping | |
| struct page * | newpage | |
| struct page * | page | |
| enum migrate_mode | mode | |
| bool | check_refs |
| 744 | If Not page_has_buffers(page) Then Return Common logic to directly migrate a single LRU page suitable for* pages that do not use PagePrivate/PagePrivate2.* Pages are locked upon entry and exit. |
| 748 | expected_count = expected_page_refs(mapping, page) |
| 749 | If page_count(page) != expected_count Then Return -EAGAIN |
| 753 | If Not Returns true if all buffers are successfully locked Then Return -EAGAIN |
| 756 | If check_refs Then |
| 758 | bool invalidated = false |
| 760 | recheck_buffers : |
| 761 | busy = false |
| 762 | spin_lock( & private_lock) |
| 764 | Do |
| 765 | If atomic_read( & users using this buffer_head ) Then |
| 766 | busy = true |
| 767 | Break |
| 771 | If busy Then |
| 772 | If invalidated Then |
| 774 | Go to unlock_buffers |
| 776 | spin_unlock( & private_lock) |
| 777 | invalidate_bh_lrus() |
| 778 | invalidated = true |
| 779 | Go to recheck_buffers |
| 784 | If rc != Return values from addresss_space_operations.migratepage():* - negative errno on page migration failure;* - zero on page migration success; Then Go to unlock_buffers |
| 788 | set_page_private(newpage, page_private(page)) |
| 789 | set_page_private(page, 0) |
| 794 | Do |
| 795 | set_bh_page(bh, newpage, bh_offset(bh)) |
| 802 | If mode != MIGRATE_SYNC_NO_COPY Then migrate_page_copy(newpage, page) |
| 804 | Else Copy the page to its new location |
| 807 | rc = Return values from addresss_space_operations.migratepage():* - negative errno on page migration failure;* - zero on page migration success; |
| 808 | unlock_buffers : |
| 809 | If check_refs Then spin_unlock( & private_lock) |
| 812 | Do |
| 813 | unlock_buffer(bh) |
| 818 | Return rc |
| Name | Describe |
|---|---|
| buffer_migrate_page | Migration function for pages with buffers. This function can only be used* if the underlying filesystem guarantees that no other references to "page"* exist. For example attached buffer heads are accessed only under page lock. |
| buffer_migrate_page_norefs | Same as above except that this variant is more careful and checks that there* are also no buffer head references. This function is the right one for* mappings where buffer heads are directly looked up and referenced (such as* block device mappings). |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |