From: tanze <tanze@kylinos.cn>
To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: willy@infradead.org, akpm@linux-foundation.org, jack@suse.cz
Subject: [PATCH v1] mm/filemap: use folio_next_index() for start
Date: Mon, 1 Jun 2026 19:04:23 +0800 [thread overview]
Message-ID: <20260601110425.44784-1-tanze@kylinos.cn> (raw)
Use folio_next_index() instead of open-coding
folio->index + folio_nr_pages(folio) when updating @start in
filemap_get_folios_contig(), filemap_get_folios_tag(), and
filemap_get_folios_dirty().
Signed-off-by: tanze <tanze@kylinos.cn>
---
mm/filemap.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index 4e636647100c..e233d4a003ce 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2283,8 +2283,7 @@ unsigned filemap_get_folios_contig(struct address_space *mapping,
goto put_folio;
if (!folio_batch_add(fbatch, folio)) {
- nr = folio_nr_pages(folio);
- *start = folio->index + nr;
+ *start = folio_next_index(folio);
goto out;
}
xas_advance(&xas, folio_next_index(folio) - 1);
@@ -2344,8 +2343,7 @@ unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start,
if (xa_is_value(folio))
continue;
if (!folio_batch_add(fbatch, folio)) {
- unsigned long nr = folio_nr_pages(folio);
- *start = folio->index + nr;
+ *start = folio_next_index(folio);
goto out;
}
}
@@ -2403,8 +2401,7 @@ unsigned filemap_get_folios_dirty(struct address_space *mapping, pgoff_t *start,
}
}
if (!folio_batch_add(fbatch, folio)) {
- unsigned long nr = folio_nr_pages(folio);
- *start = folio->index + nr;
+ *start = folio_next_index(folio);
goto out;
}
}
--
2.43.0
next reply other threads:[~2026-06-01 11:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 11:04 tanze [this message]
2026-06-01 16:25 ` Jan Kara
2026-06-01 17:48 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260601110425.44784-1-tanze@kylinos.cn \
--to=tanze@kylinos.cn \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®