Hi all:
I'm wonding why we should recheck inode->i_size and
zero_user_segment the page's tail which crossed the EOF, I think it's
already zerofilled in function __do_readpage.
function end_bio_extent_readpage:
2597 readpage_ok:
2598 if (likely(uptodate)) {
2599 loff_t i_size = i_size_read(inode);
2600 pgoff_t end_index = i_size >> PAGE_SHIFT;
2601 unsigned off;
2602
2603 /* Zero out the end if this page
straddles i_size */
2604 off = i_size & (PAGE_SIZE-1);
2605 if (page->index == end_index && off)
2606 zero_user_segment(page, off, PAGE_SIZE);
2607 SetPageUptodate(page);
2608 } else {
2609 ClearPageUptodate(page);
2610 SetPageError(page);
2611 }
2612 unlock_page(page);
2613 offset += len;
There could be one situation that the file was truncated after
__do_readpage be called, but
I think the function ”truncate_setsize” will zerofill the page's tail
which crossed the EOF
Could someone give me a hint!
Thanks!