watch_queue: use page_private() accessors
PATCH 1/1 watch_queue: use page_private() accessors
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.
---
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(-)
kernel/watch_queue.c +2 -2
@@ -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
Signature · 1 line
2.56.1.839.g22a8290db9-goog
Quoted 7 lines · Nilay Vaish
watch_queuerecords the number of the first note of each buffer page inpage->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.
Quoted 5 lines
Use
page_private()andset_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.
Quoted 35 lines
Signed-off-by Nilay Vaish <[email protected]>---
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(-)kernel/watch_queue.c +2
-2@@ -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 );
Quoted 5 lines
base-commit:
3191063649dbf7c0d0b768e1f3655e4c5fc6edb5
prerequisite-patch-id:d52d42a2ec9ddc2b12b3412ec0d07254b417e60f
prerequisite-patch-id:d8338f943ba7ae297eefbb26dabc3bcfe7994461
prerequisite-patch-id:3d99b53c242296b89d7f7b41f1995188f5a02369
--- Thanks!