[PATCH] mm/filemap: introduce local helper for_each_folio

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

 



From: Song Chen <chensong_2000@xxxxxx>

Introduce for_each_folio to iterate folios in xarray for code style
compliance and better readability.

Signed-off-by: Song Chen <chensong_2000@xxxxxx>
---
 mm/filemap.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index d62150418b91..5386348acacd 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -62,6 +62,9 @@
 
 #include "swap.h"
 
+#define for_each_folio(folio, xas, max)	\
+	for (folio = xas_load(&xas);	\
+		 folio && xas.xa_index <= max; folio = xas_next(&xas))
 /*
  * Shared mappings implemented 30.11.1994. It's not fully working yet,
  * though.
@@ -2170,8 +2173,7 @@ unsigned filemap_get_folios_contig(struct address_space *mapping,
 
 	rcu_read_lock();
 
-	for (folio = xas_load(&xas); folio && xas.xa_index <= end;
-			folio = xas_next(&xas)) {
+	for_each_folio(folio, xas, end) {
 		if (xas_retry(&xas, folio))
 			continue;
 		/*
@@ -2306,7 +2308,7 @@ static void filemap_get_read_batch(struct address_space *mapping,
 	struct folio *folio;
 
 	rcu_read_lock();
-	for (folio = xas_load(&xas); folio; folio = xas_next(&xas)) {
+	for_each_folio(folio, xas, ULONG_MAX) {
 		if (xas_retry(&xas, folio))
 			continue;
 		if (xas.xa_index > max || xa_is_value(folio))
-- 
2.34.1





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux