On 09.04.24 16:09, Matthew Wilcox wrote:
On Tue, Apr 09, 2024 at 03:39:35PM +0200, David Hildenbrand wrote:
On 05.04.24 20:00, Matthew Wilcox (Oracle) wrote:
+ * Handle extension of inode size either caused by extending truncate or
+ * by write starting after current i_size. We mark the page straddling
+ * current i_size RO so that page_mkwrite() is called on the first
+ * write access to the page. The filesystem will update its per-block
+ * information before user writes to the page via mmap after the i_size
+ * has been changed.
Did you intend not to s/page/folio/ ?
I did! I think here we're talking about page faults, and we can control
the RO property on a per-PTE (ie per-page) basis. Do you think it'd be
clearer if we talked about folios here?
Good point! It might have been clearer to me if that paragraph would
talk about PTEs mapping folio pages, whereby the relevant PTEs are R/O
such that we will catch first write access to these folio pages.
But re-reading it now, it's clearer to me taht the focus is on per-page
handling. (although it might boil down to per-folio tracking in some
cases, staring at filemap_page_mkwrite()).
We're in a bit of an interesting
spot because filesystems generally don't have folios which overhang the
end of the file by more than a page. It can happen if truncate fails
to split a folio.
Right. I remember FALLOCATE_PUNCHOLE is in a similar position if
splitting fails (cannot free up memory but have to zero it out IIRC).
--
Cheers,
David / dhildenb