Re: [PATCH v2 07/22] mm: Provide a means of invalidation without using launder_folio

From: David Howells
Date: Wed May 01 2024 - 07:51:36 EST


David Howells <dhowells@xxxxxxxxxx> wrote:

> + .range_start = first,
> + .range_end = last,
> ...
> + truncate_inode_pages_range(mapping, first, last);

These actually take file offsets and not page ranges and so the attached
change is needed. Without this, the generic/412 xfstest fails.

David
---
diff --git a/mm/filemap.c b/mm/filemap.c
index 53516305b4b4..3916fc8b10e6 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -4171,15 +4171,15 @@ int filemap_invalidate_inode(struct inode *inode, bool flush,
struct writeback_control wbc = {
.sync_mode = WB_SYNC_ALL,
.nr_to_write = LONG_MAX,
- .range_start = first,
- .range_end = last,
+ .range_start = start,
+ .range_end = end,
};

filemap_fdatawrite_wbc(mapping, &wbc);
}

/* Wait for writeback to complete on all folios and discard. */
- truncate_inode_pages_range(mapping, first, last);
+ truncate_inode_pages_range(mapping, start, end);

unlock:
filemap_invalidate_unlock(mapping);