- 论坛徽章:
- 4
|
10可用积分
- static int __block_commit_write(struct inode *inode, struct page *page,
- unsigned from, unsigned to)
- {
- unsigned block_start, block_end;
- int partial = 0;
- unsigned blocksize;
- struct buffer_head *bh, *head;
- bh = head = page_buffers(page);
- blocksize = bh->b_size;
- block_start = 0;
- do {
- block_end = block_start + blocksize;
- if (block_end <= from || block_start >= to) {//分支1
- if (!buffer_uptodate(bh))
- partial = 1;
- } else {//分支2
- set_buffer_uptodate(bh);
- mark_buffer_dirty(bh);
- }
- clear_buffer_new(bh);<---------为何不涉及的bh(分支1)也清new标志了?
- block_start = block_end;
- bh = bh->b_this_page;
- } while (bh != head);
- /*
- * If this is a partial write which happened to make all buffers
- * uptodate then we can optimize away a bogus readpage() for
- * the next read(). Here we 'discover' whether the page went
- * uptodate as a result of this (potentially partial) write.
- */
- if (!partial)
- SetPageUptodate(page);
- return 0;
- }
复制代码 望大家指点啊,谢谢! |
|