* [PATCH] watch_queue: use page_private() accessors
@ 2026-11-24 3:37 Nilay Vaish
2026-11-24 7:45 ` Bradley Morgan
0 siblings, 1 reply; 2+ messages in thread
From: Nilay Vaish @ 2026-11-24 3:37 UTC (permalink / raw)
To: David Howells; +Cc: Christian Brauner, linux-fsdevel, linux-kernel, Nilay Vaish
watch_queue records the number of the first note of each buffer 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 code 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.
kernel/watch_queue.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index e2bdd5fb0db1..eeb7fb9bc0fd 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -71,7 +71,7 @@ static void watch_queue_pipe_buf_release(struct pipe_inode_info *pipe,
bit /= WATCH_QUEUE_NOTE_SIZE;
page = buf->page;
- bit += page->private;
+ bit += page_private(page);
set_bit(bit, wqueue->notes_bitmap);
generic_pipe_buf_release(pipe, buf);
@@ -284,7 +284,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
pages[i] = alloc_page(GFP_KERNEL);
if (!pages[i])
goto error_p;
- pages[i]->private = i * WATCH_QUEUE_NOTES_PER_PAGE;
+ set_page_private(pages[i], i * WATCH_QUEUE_NOTES_PER_PAGE);
}
bitmap = bitmap_alloc(nr_notes, GFP_KERNEL);
base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5
prerequisite-patch-id: d52d42a2ec9ddc2b12b3412ec0d07254b417e60f
prerequisite-patch-id: d8338f943ba7ae297eefbb26dabc3bcfe7994461
prerequisite-patch-id: 3d99b53c242296b89d7f7b41f1995188f5a02369
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] watch_queue: use page_private() accessors
2026-11-24 3:37 [PATCH] watch_queue: use page_private() accessors Nilay Vaish
@ 2026-11-24 7:45 ` Bradley Morgan
0 siblings, 0 replies; 2+ messages in thread
From: Bradley Morgan @ 2026-11-24 7:45 UTC (permalink / raw)
To: nilayvaish; +Cc: brauner, dhowells, linux-fsdevel, linux-kernel
On 24 November 2026 03:37:40 GMT, Nilay Vaish <nilayvaish@google.com>
wrote:
>watch_queue records the number of the first note of each buffer 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 code no longer depends on where struct page keeps
>the field.
>
>No functional change.
Cool!
I like this, makes sense.
Reviewed-by: Bradley Morgan <bradley.morgan@linux.dev>
>
>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.
>
> kernel/watch_queue.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
>index e2bdd5fb0db1..eeb7fb9bc0fd 100644
>--- a/kernel/watch_queue.c
>+++ b/kernel/watch_queue.c
>@@ -71,7 +71,7 @@ static void watch_queue_pipe_buf_release(struct pipe_inode_info *pipe,
> bit /= WATCH_QUEUE_NOTE_SIZE;
>
> page = buf->page;
>- bit += page->private;
>+ bit += page_private(page);
>
> set_bit(bit, wqueue->notes_bitmap);
> generic_pipe_buf_release(pipe, buf);
>@@ -284,7 +284,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
> pages[i] = alloc_page(GFP_KERNEL);
> if (!pages[i])
> goto error_p;
>- pages[i]->private = i * WATCH_QUEUE_NOTES_PER_PAGE;
>+ set_page_private(pages[i], i * WATCH_QUEUE_NOTES_PER_PAGE);
> }
>
> bitmap = bitmap_alloc(nr_notes, GFP_KERNEL);
>
>base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5
>prerequisite-patch-id: d52d42a2ec9ddc2b12b3412ec0d07254b417e60f
>prerequisite-patch-id: d8338f943ba7ae297eefbb26dabc3bcfe7994461
>prerequisite-patch-id: 3d99b53c242296b89d7f7b41f1995188f5a02369
>
--- Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-24 7:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 3:37 [PATCH] watch_queue: use page_private() accessors Nilay Vaish
2026-11-24 7:45 ` Bradley Morgan
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®