From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "willy@infradead.org" <willy@infradead.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Cc: "hch@lst.de" <hch@lst.de>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"ira.weiny@intel.com" <ira.weiny@intel.com>
Subject: Re: [PATCH 4/5] ceph: Convert ceph_zero_partial_page() to use a folio
Date: Thu, 12 Jun 2025 19:36:12 +0000 [thread overview]
Message-ID: <80277dc7220fa255044d3d90109866aeb46a52da.camel@ibm.com> (raw)
In-Reply-To: <20250612143443.2848197-5-willy@infradead.org>
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@infradead.org>
> ---
> 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@ibm.com>
Thanks,
Slava.
next prev parent reply other threads:[~2025-06-12 19:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 14:34 [PATCH 0/5] Remove zero_user() Matthew Wilcox (Oracle)
2025-06-12 14:34 ` [PATCH 1/5] bio: Use memzero_page() in bio_truncate() Matthew Wilcox (Oracle)
2025-06-25 10:40 ` Alex Markuze
2025-06-12 14:34 ` [PATCH 2/5] null_blk: Use memzero_page() Matthew Wilcox (Oracle)
2025-06-25 10:41 ` Alex Markuze
2025-06-12 14:34 ` [PATCH 3/5] direct-io: " Matthew Wilcox (Oracle)
2025-06-25 10:40 ` Alex Markuze
2025-06-12 14:34 ` [PATCH 4/5] ceph: Convert ceph_zero_partial_page() to use a folio Matthew Wilcox (Oracle)
2025-06-12 19:36 ` Viacheslav Dubeyko [this message]
2025-06-12 14:34 ` [PATCH 5/5] mm: Remove zero_user() Matthew Wilcox (Oracle)
2025-06-25 10:41 ` Alex Markuze
2025-06-13 5:24 ` [PATCH 0/5] " Christoph Hellwig
2025-06-13 19:51 ` Matthew Wilcox
2025-06-13 20:04 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=80277dc7220fa255044d3d90109866aeb46a52da.camel@ibm.com \
--to=slava.dubeyko@ibm.com \
--cc=akpm@linux-foundation.org \
--cc=ceph-devel@vger.kernel.org \
--cc=hch@lst.de \
--cc=ira.weiny@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).