[PATCH v2 1/5] ceph: use a folio in ceph_get_caps()
From: Tal Zussman
Date: Wed Sep 02 2026 - 13:43:34 EST
Convert the inline data page cache check to filemap_get_folio(), which
returns an ERR_PTR instead of NULL when no folio is present. Saves two
calls to compound_head().
Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>
---
fs/ceph/caps.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 1847badddd87..5be858df0a4d 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3202,12 +3202,12 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need,
ceph_has_inline_data(ci) &&
(_got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) &&
i_size_read(inode) > 0) {
- struct page *page =
- find_get_page(inode->i_mapping, 0);
- if (page) {
- bool uptodate = PageUptodate(page);
+ struct folio *folio =
+ filemap_get_folio(inode->i_mapping, 0);
+ if (!IS_ERR(folio)) {
+ bool uptodate = folio_test_uptodate(folio);
- put_page(page);
+ folio_put(folio);
if (uptodate)
break;
}
--
2.39.5