Function report |
Source Code:fs\mpage.c |
Create Date:2022-07-28 20:15:33 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:__mpage_writepage
Proto:static int __mpage_writepage(struct page *page, struct writeback_control *wbc, void *data)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct page * | page | |
| struct writeback_control * | wbc | |
| void * | data |
| 505 | blocks_per_page = PAGE_SIZE >> blkbits |
| 511 | struct block_device * bdev = NULL |
| 512 | boundary = 0 |
| 513 | boundary_block = 0 |
| 514 | struct block_device * boundary_bdev = NULL |
| 518 | ret = 0 |
| 519 | op_flags = wbc_to_write_flags(wbc) |
| 521 | If page_has_buffers(page) Then |
| 526 | page_block = 0 |
| 527 | Do |
| 528 | BUG_ON(buffer_locked(bh)) |
| 529 | If Not buffer_mapped(bh) Then |
| 534 | If buffer_dirty(bh) Then Go to confused |
| 536 | If first_unmapped == blocks_per_page Then first_unmapped = page_block |
| 538 | Continue |
| 541 | If first_unmapped != blocks_per_page Then Go to confused |
| 546 | If page_block Then |
| 547 | If start block number != blocks[page_block - 1] + 1 Then Go to confused |
| 550 | blocks[page_block++] = start block number |
| 551 | boundary = buffer_boundary(bh) |
| 552 | If boundary Then |
| 554 | boundary_bdev = b_bdev |
| 557 | When (bh = circular list of page's buffers ) != head cycle |
| 559 | If first_unmapped Then Go to page_is_mapped |
| 568 | Go to confused |
| 574 | BUG_ON(!PageUptodate(page)) |
| 576 | last_block = i_size - 1 >> blkbits |
| 578 | When page_block < blocks_per_page cycle |
| 580 | buffer state bitmap (see above) = 0 |
| 581 | size of mapping = 1 << blkbits |
| 582 | If get_block(inode, block_in_file, & map_bh, 1) Then Go to confused |
| 584 | If buffer_new( & map_bh) Then clean_bdev_bh_alias( & map_bh) |
| 586 | If buffer_boundary( & map_bh) Then |
| 588 | boundary_bdev = b_bdev |
| 590 | If page_block Then |
| 591 | If start block number != blocks[page_block - 1] + 1 Then Go to confused |
| 594 | blocks[page_block++] = start block number |
| 595 | boundary = buffer_boundary( & map_bh) |
| 597 | If block_in_file == last_block Then Break |
| 599 | block_in_file++ |
| 601 | BUG_ON(page_block == 0) |
| 603 | first_unmapped = page_block |
| 605 | page_is_mapped : |
| 607 | If Our offset within mapping. >= end_index Then |
| 618 | If Our offset within mapping. > end_index || Not offset Then Go to confused |
| 620 | zero_user_segment(page, offset, PAGE_SIZE) |
| 626 | If bio && last_block_in_bio != blocks[0] - 1 Then bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio) |
| 629 | alloc_new : |
| 630 | If (bio == NULL) Then |
| 631 | If first_unmapped == blocks_per_page Then |
| 636 | bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), BIO_MAX_PAGES, GFP_NOFS | __GFP_HIGH) |
| 641 | wbc_init_bio(wbc, bio) |
| 642 | bi_write_hint = i_write_hint |
| 650 | wbc_account_cgroup_owner(wbc, page, PAGE_SIZE) |
| 651 | length = first_unmapped << blkbits |
| 652 | If bio_add_page(bio, page, length, 0) < length Then |
| 653 | bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio) |
| 654 | Go to alloc_new |
| 659 | BUG_ON(Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting.) |
| 660 | set_page_writeback(page) |
| 662 | If boundary || first_unmapped != blocks_per_page Then |
| 663 | bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio) |
| 664 | If boundary_block Then |
| 668 | Else |
| 669 | last_block_in_bio = blocks[blocks_per_page - 1] |
| 671 | Go to out |
| 673 | confused : |
| 674 | If bio Then bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio) |
| 677 | If use_writepage Then |
| 679 | Else |
| 687 | out : |
| 689 | Return ret |
| Name | Describe |
|---|---|
| mpage_writepage |
| 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 |