Skip to content

Commit 60d8231

Browse files
author
Matthew Wilcox (Oracle)
committed
iomap: Support large folios in invalidatepage
If we're punching a hole in a large folio, we need to remove the per-folio iomap data as the folio is about to be split and each page will need its own. If a dirty folio is only partially-uptodate, the iomap data contains the information about which blocks cannot be written back, so assert that a dirty folio is fully uptodate. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]>
1 parent 589110e commit 60d8231

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/iomap/buffered-io.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,13 +481,18 @@ void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len)
481481
trace_iomap_invalidatepage(folio->mapping->host, offset, len);
482482

483483
/*
484-
* If we're invalidating the entire page, clear the dirty state from it
485-
* and release it to avoid unnecessary buildup of the LRU.
484+
* If we're invalidating the entire folio, clear the dirty state
485+
* from it and release it to avoid unnecessary buildup of the LRU.
486486
*/
487487
if (offset == 0 && len == folio_size(folio)) {
488488
WARN_ON_ONCE(folio_test_writeback(folio));
489489
folio_cancel_dirty(folio);
490490
iomap_page_release(folio);
491+
} else if (folio_test_large(folio)) {
492+
/* Must release the iop so the page can be split */
493+
WARN_ON_ONCE(!folio_test_uptodate(folio) &&
494+
folio_test_dirty(folio));
495+
iomap_page_release(folio);
491496
}
492497
}
493498
EXPORT_SYMBOL_GPL(iomap_invalidate_folio);

0 commit comments

Comments
 (0)