[PATCH v2] libceph: remove ceph_put_page_vector()

From: Tal Zussman

Date: Mon Aug 17 2026 - 15:29:36 EST


ceph_put_page_vector() was paired with ceph_get_direct_page_vector(),
which was removed in commit 97a385e55829 ("libceph: remove
ceph_get_direct_page_vector()"). Its only remaining caller,
finish_netfs_read(), uses it to put a page vector allocated with
iov_iter_get_pages_alloc2(), which is confusing. Open-code the
put_page() loop and kvfree() there instead.

The caller passed dirty = false, so this also removes the dead dirty
branch and with it a call to the deprecated set_page_dirty_lock().

Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>
---
Changes in v2:
- Remove ceph_put_page_vector() entirely instead of only the dead
dirty path, open-coding the cleanup in finish_netfs_read(), per Ilya
- Rebase onto ceph/for-linus
- Link to v1: https://lore.kernel.org/r/20260809-ceph-put-page-vector-v1-1-57ab2a08ec90@xxxxxxxxxxxx
---
fs/ceph/addr.c | 9 ++++++---
include/linux/ceph/libceph.h | 2 --
net/ceph/pagevec.c | 13 -------------
3 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index ecf33b66610c..0af7387ce7ec 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -255,9 +255,12 @@ static void finish_netfs_read(struct ceph_osd_request *req)
}

if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) {
- ceph_put_page_vector(osd_data->pages,
- calc_pages_for(osd_data->alignment,
- osd_data->length), false);
+ int num_pages = calc_pages_for(osd_data->alignment,
+ osd_data->length);
+
+ for (int i = 0; i < num_pages; i++)
+ put_page(osd_data->pages[i]);
+ kvfree(osd_data->pages);
}
if (err > 0) {
ceph_subvolume_metrics_record_io(fsc->mdsc, ceph_inode(inode),
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 63e0e2aa1ce9..691e1bdece49 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -313,8 +313,6 @@ int ceph_wait_for_latest_osdmap(struct ceph_client *client,

/* pagevec.c */
extern void ceph_release_page_vector(struct page **pages, int num_pages);
-extern void ceph_put_page_vector(struct page **pages, int num_pages,
- bool dirty);
extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
extern void ceph_copy_from_page_vector(struct page **pages,
void *data,
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c
index 858359873c4d..a6aa5b3b7a1e 100644
--- a/net/ceph/pagevec.c
+++ b/net/ceph/pagevec.c
@@ -10,19 +10,6 @@

#include <linux/ceph/libceph.h>

-void ceph_put_page_vector(struct page **pages, int num_pages, bool dirty)
-{
- int i;
-
- for (i = 0; i < num_pages; i++) {
- if (dirty)
- set_page_dirty_lock(pages[i]);
- put_page(pages[i]);
- }
- kvfree(pages);
-}
-EXPORT_SYMBOL(ceph_put_page_vector);
-
void ceph_release_page_vector(struct page **pages, int num_pages)
{
int i;

---
base-commit: 91880e4a7fac45bc407771bc57bbaf4f37e9b4c3
change-id: 20260809-ceph-put-page-vector-458bb3aa87f6

Best regards,
--
Tal Zussman <tz2294@xxxxxxxxxxxx>