Skip to contentSkip to conversation

ceph: remove two users of __page_cache_alloc()

PATCH In review Tal Zussman 2 participants 4 messages Sep 14 – Sep 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ceph: remove two users of __page_cache_alloc()

__page_cache_alloc() is slated for removal. Switch over two of its callers that do not need a page cache page to use alloc_page() instead.

---
Tal Zussman (2):
libceph: use alloc_page() in ceph_alloc_page_vector()
ceph: use alloc_page() in fill_fscrypt_truncate()

 fs/ceph/inode.c    | 2 +-
 net/ceph/pagevec.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

---
base-commit: 4d584eadc178349f4d2b4f37ff71d025b4ad1921
change-id: 20260913-ceph-alloc-page-6837c754bf78

Best regards,

Signature · 1 line
Tal Zussman <[email protected]>
#1 lore raw

PATCH 1/2 libceph: use alloc_page() in ceph_alloc_page_vector()

ceph_alloc_page_vector() allocates its pages with __page_cache_alloc(). However, the pages are never inserted into an address_space and do not need the cpuset memory spread policy __page_cache_alloc() provides. Use alloc_page() instead.

---
 net/ceph/pagevec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/pagevec.c +1 -1
index a6aa5b3b7a1e..885e58c2d129 100644
@@ -32,7 +32,7 @@ struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags)
 	if (!pages)
 		return ERR_PTR(-ENOMEM);
 	for (i = 0; i < num_pages; i++) {
-		pages[i] = __page_cache_alloc(flags);
+		pages[i] = alloc_page(flags);
 		if (pages[i] == NULL) {
 			ceph_release_page_vector(pages, i);
 			return ERR_PTR(-ENOMEM);
Signature · 1 line
2.39.5
#2 lore raw

PATCH 2/2 ceph: use alloc_page() in fill_fscrypt_truncate()

In reply to Tal Zussman

fill_fscrypt_truncate() allocates a scratch page with __page_cache_alloc(). The page never enters the page cache and is freed with __free_pages(). It does not need the cpuset memory spread policy that __page_cache_alloc() applies, so use alloc_page() instead.

---
 fs/ceph/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/inode.c +1 -1
index 149a82f0b3c8..63c3973fbb9d 100644
@@ -2547,7 +2547,7 @@ static int fill_fscrypt_truncate(struct inode *inode,
 			goto out;
 	}
 
-	page = __page_cache_alloc(GFP_KERNEL);
+	page = alloc_page(GFP_KERNEL);
 	if (page == NULL) {
 		ret = -ENOMEM;
 		goto out;
Signature · 1 line
2.39.5