This patchset replaces the remaining calls of try_to_release_page() with
the folio equivalent: filemap_release_folio(). This allows us to remove
the wrapper.
The set passes fstests on ext4 and xfs.
Vishal Moola (Oracle) (4):
ext4: Convert move_extent_per_page() to use folios
khugepage: Replace try_to_release_page() with filemap_release_folio()
memory-failure: Convert truncate_error_page() to use folio
folio-compat: Remove try_to_release_page()
fs/ext4/move_extent.c | 47 +++++++++++++++++++++++------------------
include/linux/pagemap.h | 1 -
mm/folio-compat.c | 6 ------
mm/khugepaged.c | 23 ++++++++++----------
mm/memory-failure.c | 5 +++--
5 files changed, 41 insertions(+), 41 deletions(-)
--
2.38.1
There are no more callers of try_to_release_page(), so remove it. This
saves 149 bytes of kernel text.
Signed-off-by: Vishal Moola (Oracle) <[email protected]>
---
include/linux/pagemap.h | 1 -
mm/folio-compat.c | 6 ------
2 files changed, 7 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index bbccb4044222..daf5e1a1d313 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -1107,7 +1107,6 @@ void __filemap_remove_folio(struct folio *folio, void *shadow);
void replace_page_cache_page(struct page *old, struct page *new);
void delete_from_page_cache_batch(struct address_space *mapping,
struct folio_batch *fbatch);
-int try_to_release_page(struct page *page, gfp_t gfp);
bool filemap_release_folio(struct folio *folio, gfp_t gfp);
loff_t mapping_seek_hole_data(struct address_space *, loff_t start, loff_t end,
int whence);
diff --git a/mm/folio-compat.c b/mm/folio-compat.c
index e1e23b4947d7..9318a0bd9155 100644
--- a/mm/folio-compat.c
+++ b/mm/folio-compat.c
@@ -129,12 +129,6 @@ void delete_from_page_cache(struct page *page)
return filemap_remove_folio(page_folio(page));
}
-int try_to_release_page(struct page *page, gfp_t gfp)
-{
- return filemap_release_folio(page_folio(page), gfp);
-}
-EXPORT_SYMBOL(try_to_release_page);
-
int isolate_lru_page(struct page *page)
{
if (WARN_RATELIMIT(PageTail(page), "trying to isolate tail page"))
--
2.38.1
Replaces try_to_release_page() with filemap_release_folio(). This change
is in preparation for the removal of the try_to_release_page() wrapper.
Signed-off-by: Vishal Moola (Oracle) <[email protected]>
---
mm/memory-failure.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 145bb561ddb3..92ec9b0e58a3 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -827,12 +827,13 @@ static int truncate_error_page(struct page *p, unsigned long pfn,
int ret = MF_FAILED;
if (mapping->a_ops->error_remove_page) {
+ struct folio *folio = page_folio(p);
int err = mapping->a_ops->error_remove_page(mapping, p);
if (err != 0) {
pr_info("%#lx: Failed to punch page: %d\n", pfn, err);
- } else if (page_has_private(p) &&
- !try_to_release_page(p, GFP_NOIO)) {
+ } else if (folio_has_private(folio) &&
+ !filemap_release_folio(folio, GFP_NOIO)) {
pr_info("%#lx: failed to release buffers\n", pfn);
} else {
ret = MF_RECOVERED;
--
2.38.1
On Tue, Nov 15, 2022 at 06:10:10PM -0800, Vishal Moola (Oracle) wrote:
> Replaces try_to_release_page() with filemap_release_folio(). This change
> is in preparation for the removal of the try_to_release_page() wrapper.
>
> Signed-off-by: Vishal Moola (Oracle) <[email protected]>
Looks good to me, thank you.
Acked-by: Naoya Horiguchi <[email protected]>
> ---
> mm/memory-failure.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 145bb561ddb3..92ec9b0e58a3 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -827,12 +827,13 @@ static int truncate_error_page(struct page *p, unsigned long pfn,
> int ret = MF_FAILED;
>
> if (mapping->a_ops->error_remove_page) {
> + struct folio *folio = page_folio(p);
> int err = mapping->a_ops->error_remove_page(mapping, p);
>
> if (err != 0) {
> pr_info("%#lx: Failed to punch page: %d\n", pfn, err);
> - } else if (page_has_private(p) &&
> - !try_to_release_page(p, GFP_NOIO)) {
> + } else if (folio_has_private(folio) &&
> + !filemap_release_folio(folio, GFP_NOIO)) {
> pr_info("%#lx: failed to release buffers\n", pfn);
> } else {
> ret = MF_RECOVERED;
> --
> 2.38.1