On Thu, 2025-06-12 at 15:34 +0100, Matthew Wilcox (Oracle) wrote: > 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(). > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> > --- > fs/ceph/file.c | 21 ++++++++++----------- > 1 file changed, 10 insertions(+), 11 deletions(-) > > diff --git a/fs/ceph/file.c b/fs/ceph/file.c > index a7254cab44cc..d5c674d2ba8a 100644 > --- a/fs/ceph/file.c > +++ b/fs/ceph/file.c > @@ -2530,18 +2530,17 @@ 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; > - > - 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); > + struct folio *folio; > + > + folio = filemap_lock_folio(inode->i_mapping, offset >> PAGE_SHIFT); > + if (folio) { > + folio_wait_writeback(folio); > + folio_zero_range(folio, offset_in_folio(folio, offset), size); > + folio_unlock(folio); > + folio_put(folio); > } > } > Looks really good. And filemap_lock_folio() is more efficient than find_lock_page() now. Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@xxxxxxx> Thanks, Slava.