lkml.org 
[lkml]   [2020]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v5 15/39] iomap: Support large pages in invalidatepage
Date
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

If we're punching a hole in a large page, we need to remove the per-page
iomap data, but not clear the dirty bit from the page, so separate the
two conditions.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/iomap/buffered-io.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 423ffc9d4a97..23eaaf1de906 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -493,17 +493,21 @@ EXPORT_SYMBOL_GPL(iomap_releasepage);
void
iomap_invalidatepage(struct page *page, unsigned int offset, unsigned int len)
{
+ bool full_page = (offset == 0) && (len == thp_size(page));
trace_iomap_invalidatepage(page->mapping->host, offset, len);

/*
* If we are invalidating the entire page, clear the dirty state from it
* and release it to avoid unnecessary buildup of the LRU.
*/
- if (offset == 0 && len == PAGE_SIZE) {
+ if (full_page) {
WARN_ON_ONCE(PageWriteback(page));
cancel_dirty_page(page);
- iomap_page_release(page);
}
+
+ /* Punching a hole in a THP requires releasing the iop */
+ if (full_page || thp_order(page) > 0)
+ iomap_page_release(page);
}
EXPORT_SYMBOL_GPL(iomap_invalidatepage);

--
2.26.2
\
 
 \ /
  Last update: 2020-05-29 05:03    [W:0.156 / U:4.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site