[PATCH 04/11] mm/page_io: take a const folio in bio_associate_blkg_from_folio()
From: Tal Zussman
Date: Wed Sep 02 2026 - 16:30:11 EST
bio_associate_blkg_from_folio() and its helpers only read from the
folio. Constify their folio arguments.
Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>
---
mm/page_io.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/mm/page_io.c b/mm/page_io.c
index 1da4ff484f09..5f7756e370f7 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -256,12 +256,13 @@ int swap_writeout(struct swap_io_ctx *ctx, struct folio *folio)
}
#if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP)
-static struct cgroup_subsys_state *folio_memcg_blkg_css(struct folio *folio)
+static struct cgroup_subsys_state *folio_memcg_blkg_css(const struct folio *folio)
{
return cgroup_e_css(folio_memcg(folio)->css.cgroup, &io_cgrp_subsys);
}
-static bool folio_blkg_can_merge(struct folio *folio, struct folio *prev_folio)
+static bool folio_blkg_can_merge(const struct folio *folio,
+ const struct folio *prev_folio)
{
bool can_merge = true;
@@ -277,7 +278,8 @@ static bool folio_blkg_can_merge(struct folio *folio, struct folio *prev_folio)
return can_merge;
}
-static void bio_associate_blkg_from_folio(struct bio *bio, struct folio *folio)
+static void bio_associate_blkg_from_folio(struct bio *bio,
+ const struct folio *folio)
{
struct cgroup_subsys_state *css;
@@ -294,11 +296,13 @@ static void bio_associate_blkg_from_folio(struct bio *bio, struct folio *folio)
css_put(css);
}
#else
-static bool folio_blkg_can_merge(struct folio *folio, struct folio *prev_folio)
+static bool folio_blkg_can_merge(const struct folio *folio,
+ const struct folio *prev_folio)
{
return true;
}
-static void bio_associate_blkg_from_folio(struct bio *bio, struct folio *folio)
+static void bio_associate_blkg_from_folio(struct bio *bio,
+ const struct folio *folio)
{
}
#endif /* CONFIG_MEMCG && CONFIG_BLK_CGROUP */
--
2.39.5