ceph: convert ceph_zero_partial_page() to use a folio

Retrieve a folio from the pagecache instead of a page and operate on it. 
Removes several hidden calls to compound_head() along with calls to
deprecated functions like wait_on_page_writeback() and find_lock_page().

[dan.carpenter@linaro.org: fix NULL vs IS_ERR() bug in ceph_zero_partial_page()]
  Link: https://lkml.kernel.org/r/685c1424.050a0220.baa8.d6a1@mx.google.com
Link: https://lkml.kernel.org/r/20250612143443.2848197-5-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Xiubo Li <xiubli@redhat.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Alex Markuze <amarkuze@redhat.com>
Cc: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Matthew Wilcox (Oracle)
2025-07-09 22:42:09 -07:00
committed by Andrew Morton
parent 88b478e55c
commit 7431f3a201
+11 -11
View File
@@ -2530,19 +2530,19 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
return generic_file_llseek(file, offset, whence);
}
static inline void ceph_zero_partial_page(
struct inode *inode, loff_t offset, unsigned size)
static inline void ceph_zero_partial_page(struct inode *inode,
loff_t offset, size_t size)
{
struct page *page;
pgoff_t index = offset >> PAGE_SHIFT;
struct folio *folio;
page = find_lock_page(inode->i_mapping, index);
if (page) {
wait_on_page_writeback(page);
zero_user(page, offset & (PAGE_SIZE - 1), size);
unlock_page(page);
put_page(page);
}
folio = filemap_lock_folio(inode->i_mapping, offset >> PAGE_SHIFT);
if (IS_ERR(folio))
return;
folio_wait_writeback(folio);
folio_zero_range(folio, offset_in_folio(folio, offset), size);
folio_unlock(folio);
folio_put(folio);
}
static void ceph_zero_pagecache_range(struct inode *inode, loff_t offset,