buffer: convert block_page_mkwrite() to use a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 12 Jun 2023 21:01:34 +0000 (22:01 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 19 Jun 2023 23:19:31 +0000 (16:19 -0700)
commitfe181377a23cce5987fc32f1877cfcd223561609
tree72e706063b9f7ec7c31d071435808b4e79f25012
parentbb0ea5989c093c14b6d6af03eed4a4fd85c50a0b
buffer: convert block_page_mkwrite() to use a folio

If any page in a folio is dirtied, dirty the entire folio.  Removes a
number of hidden calls to compound_head() and references to page->mapping
and page->index.  Fixes a pre-existing bug where we could mark a folio as
dirty if the file is truncated to a multiple of the page size just as we
take the page fault.  I don't believe this bug has any bad effect, it's
just inefficient.

Link: https://lkml.kernel.org/r/20230612210141.730128-8-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Bob Peterson <rpeterso@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/buffer.c