linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question about function ”end_bio_extent_readpage” in btrfs
@ 2018-12-01 13:41 Zhengping Zhou
  0 siblings, 0 replies; only message in thread
From: Zhengping Zhou @ 2018-12-01 13:41 UTC (permalink / raw)
  To: linux-btrfs

  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!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-01 13:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-01 13:41 Question about function ”end_bio_extent_readpage” in btrfs Zhengping Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).