From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
akpm <akpm@linux-foundation.org>
Cc: ocfs2-devel@lists.linux.dev, Mark Tinguely <mark.tinguely@oracle.com>
Subject: Re: [PATCH 19/23] ocfs2: Convert ocfs2_read_inline_data() to take a folio
Date: Sat, 14 Dec 2024 22:39:06 +0800 [thread overview]
Message-ID: <e3201069-a679-456f-84aa-fef7e6faafaf@linux.alibaba.com> (raw)
In-Reply-To: <20241205171653.3179945-20-willy@infradead.org>
On 2024/12/6 01:16, Matthew Wilcox (Oracle) wrote:
> All callers now have a folio, so pass it in. We can use
> folio_fill_tail() instead of open-coding it. Saves a call to
> compound_head().
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Looks good.
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
> fs/ocfs2/alloc.c | 2 +-
> fs/ocfs2/aops.c | 20 ++++++--------------
> fs/ocfs2/aops.h | 2 +-
> 3 files changed, 8 insertions(+), 16 deletions(-)
>
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index c8d9d5e9a7fd..36b536b54a2d 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -7135,7 +7135,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
> * This should populate the 1st page for us and mark
> * it up to date.
> */
> - ret = ocfs2_read_inline_data(inode, &folio->page, di_bh);
> + ret = ocfs2_read_inline_data(inode, folio, di_bh);
> if (ret) {
> mlog_errno(ret);
> need_free = 1;
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index f1eba968563f..80fe7a68cbcc 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -215,10 +215,9 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
> return err;
> }
>
> -int ocfs2_read_inline_data(struct inode *inode, struct page *page,
> +int ocfs2_read_inline_data(struct inode *inode, struct folio *folio,
> struct buffer_head *di_bh)
> {
> - void *kaddr;
> loff_t size;
> struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
>
> @@ -230,7 +229,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
>
> size = i_size_read(inode);
>
> - if (size > PAGE_SIZE ||
> + if (size > folio_size(folio) ||
> size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) {
> ocfs2_error(inode->i_sb,
> "Inode %llu has with inline data has bad size: %Lu\n",
> @@ -239,15 +238,8 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
> return -EROFS;
> }
>
> - kaddr = kmap_atomic(page);
> - if (size)
> - memcpy(kaddr, di->id2.i_data.id_data, size);
> - /* Clear the remaining part of the page */
> - memset(kaddr + size, 0, PAGE_SIZE - size);
> - flush_dcache_page(page);
> - kunmap_atomic(kaddr);
> -
> - SetPageUptodate(page);
> + folio_fill_tail(folio, 0, di->id2.i_data.id_data, size);
> + folio_mark_uptodate(folio);
>
> return 0;
> }
> @@ -266,7 +258,7 @@ static int ocfs2_readpage_inline(struct inode *inode, struct folio *folio)
> goto out;
> }
>
> - ret = ocfs2_read_inline_data(inode, &folio->page, di_bh);
> + ret = ocfs2_read_inline_data(inode, folio, di_bh);
> out:
> folio_unlock(folio);
>
> @@ -1506,7 +1498,7 @@ static int ocfs2_write_begin_inline(struct address_space *mapping,
> ocfs2_set_inode_data_inline(inode, di);
>
> if (!folio_test_uptodate(folio)) {
> - ret = ocfs2_read_inline_data(inode, &folio->page, wc->w_di_bh);
> + ret = ocfs2_read_inline_data(inode, folio, wc->w_di_bh);
> if (ret) {
> ocfs2_commit_trans(osb, handle);
>
> diff --git a/fs/ocfs2/aops.h b/fs/ocfs2/aops.h
> index cf8d202d9a8b..6f25066e5756 100644
> --- a/fs/ocfs2/aops.h
> +++ b/fs/ocfs2/aops.h
> @@ -41,7 +41,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
> struct folio **foliop, void **fsdata,
> struct buffer_head *di_bh, struct folio *mmap_folio);
>
> -int ocfs2_read_inline_data(struct inode *inode, struct page *page,
> +int ocfs2_read_inline_data(struct inode *inode, struct folio *folio,
> struct buffer_head *di_bh);
> int ocfs2_size_fits_inline_data(struct buffer_head *di_bh, u64 new_size);
>
next prev parent reply other threads:[~2024-12-14 14:39 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 17:16 [PATCH 00/23] Convert ocfs2 to use folios Matthew Wilcox (Oracle)
2024-12-05 17:16 ` [PATCH 01/23] ocfs2: Handle a symlink read error correctly Matthew Wilcox (Oracle)
2024-12-14 12:03 ` Joseph Qi
2024-12-14 15:20 ` Matthew Wilcox
2024-12-14 15:45 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 02/23] ocfs2: Convert ocfs2_page_mkwrite() to use a folio Matthew Wilcox (Oracle)
2024-12-14 12:20 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 03/23] ocfs2: Convert w_target_page to w_target_folio Matthew Wilcox (Oracle)
2024-12-14 12:29 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 04/23] ocfs2: Use a folio in ocfs2_zero_new_buffers() Matthew Wilcox (Oracle)
2024-12-14 14:01 ` Joseph Qi
2024-12-14 15:32 ` Matthew Wilcox
2024-12-14 15:46 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 05/23] ocfs2: Use a folio in ocfs2_write_begin_inline() Matthew Wilcox (Oracle)
2024-12-14 14:04 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 06/23] ocfs2: Pass mmap_folio around instead of mmap_page Matthew Wilcox (Oracle)
2024-12-14 14:08 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 07/23] ocfs2: Convert ocfs2_readpage_inline() to take a folio Matthew Wilcox (Oracle)
2024-12-14 14:08 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 08/23] ocfs2: Convert ocfs2_inode_lock_with_page() to ocfs2_inode_lock_with_folio() Matthew Wilcox (Oracle)
2024-12-14 14:10 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 09/23] ocfs2: Convert w_pages to w_folios Matthew Wilcox (Oracle)
2024-12-14 14:15 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 10/23] ocfs2: Convert ocfs2_write_failure() to use a folio Matthew Wilcox (Oracle)
2024-12-14 14:16 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 11/23] ocfs2: Use a folio in ocfs2_write_end_nolock() Matthew Wilcox (Oracle)
2024-12-14 14:18 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 12/23] ocfs2: Use a folio in ocfs2_prepare_page_for_write() Matthew Wilcox (Oracle)
2024-12-14 14:26 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 13/23] ocfs2: Use a folio in ocfs2_map_and_dirty_page() Matthew Wilcox (Oracle)
2024-12-14 14:27 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 14/23] ocfs2: Convert ocfs2_map_page_blocks() to ocfs2_map_folio_blocks() Matthew Wilcox (Oracle)
2024-12-14 14:28 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 15/23] ocfs2: Convert ocfs2_clear_page_regions() to ocfs2_clear_folio_regions() Matthew Wilcox (Oracle)
2024-12-14 14:29 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 16/23] ocfs2: Use an array of folios instead of an array of pages Matthew Wilcox (Oracle)
2024-12-14 14:34 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 17/23] ocfs2: Convert ocfs2_duplicate_clusters_by_page() to use a folio Matthew Wilcox (Oracle)
2024-12-14 14:36 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 18/23] ocfs2: Convert ocfs2_map_and_dirty_page() to ocfs2_map_and_dirty_folio() Matthew Wilcox (Oracle)
2024-12-14 14:36 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 19/23] ocfs2: Convert ocfs2_read_inline_data() to take a folio Matthew Wilcox (Oracle)
2024-12-14 14:39 ` Joseph Qi [this message]
2024-12-05 17:16 ` [PATCH 20/23] ocfs2: Use a folio in ocfs2_fast_symlink_read_folio() Matthew Wilcox (Oracle)
2024-12-14 14:43 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 21/23] ocfs2: Remove ocfs2_start_walk_page_trans() prototype Matthew Wilcox (Oracle)
2024-12-14 14:44 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 22/23] ocfs2: Support large folios in ocfs2_zero_cluster_folios() Matthew Wilcox (Oracle)
2024-12-14 14:50 ` Joseph Qi
2024-12-05 17:16 ` [PATCH 23/23] ocfs2: Support large folios in ocfs2_write_zero_page() Matthew Wilcox (Oracle)
2024-12-14 14:51 ` Joseph Qi
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=e3201069-a679-456f-84aa-fef7e6faafaf@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=mark.tinguely@oracle.com \
--cc=ocfs2-devel@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.