[PATCH] mm/filemap: set folio->mapping to NULL before xas_store()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Functions such as __filemap_get_folio() check the truncation of
folios based on the mapping field. Therefore setting this field to NULL
earlier prevents unnecessary operations on already removed folios.

Signed-off-by: Soma Nakata <soma.nakata01@xxxxxxxxx>
---
 mm/filemap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 2723104cc06a..79bac7c00084 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -139,11 +139,12 @@ static void page_cache_delete(struct address_space *mapping,
 
 	VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
 
+	folio->mapping = NULL;
+	/* Leave page->index set: truncation lookup relies upon it */
+
 	xas_store(&xas, shadow);
 	xas_init_marks(&xas);
 
-	folio->mapping = NULL;
-	/* Leave page->index set: truncation lookup relies upon it */
 	mapping->nrpages -= nr;
 }
 
-- 
2.25.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux