From: Nilay Vaish <nilayvaish@google.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Nilay Vaish <nilayvaish@google.com>
Subject: [PATCH] null_blk: use page_private() accessors
Date: Mon, 23 Nov 2026 19:36:30 -0800 [thread overview]
Message-ID: <20261124033630.832566-1-nilayvaish@google.com> (raw)
null_blk keeps the index of each backing page in page->private, reading
and writing the field directly.
struct page is being shrunk as part of the memdesc work, and its private
field is one of those that will move. Direct users have to go through
the accessors before that can happen.
Use page_private() and set_page_private() instead, like the rest of the
kernel, so that the driver no longer depends on where struct page keeps
the field.
No functional change.
Signed-off-by: Nilay Vaish <nilayvaish@google.com>
---
Notes:
This patch was written with the help of an AI coding assistant (Gemini).
Based on next-20261123.
drivers/block/null_blk/main.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index ec0d7ba4d938..901952e911b3 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -941,7 +941,7 @@ static struct nullb_page *null_radix_tree_insert(struct nullb *nullb, u64 idx,
if (radix_tree_insert(root, idx, t_page)) {
null_free_page(t_page);
t_page = radix_tree_lookup(root, idx);
- WARN_ON(!t_page || t_page->page->private != idx);
+ WARN_ON(!t_page || page_private(t_page->page) != idx);
} else if (is_cache)
nullb->dev->curr_cache += PAGE_SIZE;
@@ -964,7 +964,7 @@ static void null_free_device_storage(struct nullb_device *dev, bool is_cache)
(void **)t_pages, pos, FREE_BATCH);
for (i = 0; i < nr_pages; i++) {
- pos = t_pages[i]->page->private;
+ pos = page_private(t_pages[i]->page);
ret = radix_tree_delete_item(root, pos, t_pages[i]);
WARN_ON(ret != t_pages[i]);
null_free_page(ret);
@@ -990,7 +990,7 @@ static struct nullb_page *__null_lookup_page(struct nullb *nullb,
root = is_cache ? &nullb->dev->cache : &nullb->dev->data;
t_page = radix_tree_lookup(root, idx);
- WARN_ON(t_page && t_page->page->private != idx);
+ WARN_ON(t_page && page_private(t_page->page) != idx);
if (t_page && (for_write || test_bit(sector_bit, t_page->bitmap)))
return t_page;
@@ -1033,7 +1033,7 @@ static struct nullb_page *null_insert_page(struct nullb *nullb,
spin_lock_irq(&nullb->lock);
idx = sector >> PAGE_SECTORS_SHIFT;
- t_page->page->private = idx;
+ set_page_private(t_page->page, idx);
t_page = null_radix_tree_insert(nullb, idx, t_page, !ignore_cache);
radix_tree_preload_end();
@@ -1053,7 +1053,7 @@ static int null_flush_cache_page(struct nullb *nullb, struct nullb_page *c_page)
struct nullb_page *t_page, *ret;
void *dst, *src;
- idx = c_page->page->private;
+ idx = page_private(c_page->page);
t_page = null_insert_page(nullb, idx << PAGE_SECTORS_SHIFT, true);
@@ -1112,7 +1112,7 @@ static int null_make_cache_space(struct nullb *nullb, unsigned long n)
* avoid race, we don't allow page free
*/
for (i = 0; i < nr_pages; i++) {
- nullb->cache_flush_pos = c_pages[i]->page->private;
+ nullb->cache_flush_pos = page_private(c_pages[i]->page);
/*
* We found the page which is being flushed to disk by other
* threads
base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5
prerequisite-patch-id: d52d42a2ec9ddc2b12b3412ec0d07254b417e60f
--
2.56.1.839.g22a8290db9-goog
reply other threads:[~2026-11-24 3:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261124033630.832566-1-nilayvaish@google.com \
--to=nilayvaish@google.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.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