diff mbox series

[07/23] ocfs2: Convert ocfs2_readpage_inline() to take a folio

Message ID 20241205171653.3179945-8-willy@infradead.org (mailing list archive)
State New
Headers show
Series Convert ocfs2 to use folios | expand

Commit Message

Matthew Wilcox (Oracle) Dec. 5, 2024, 5:16 p.m. UTC
From: Mark Tinguely <mark.tinguely@oracle.com>

Save a couple of calls to compound_head() by using a folio throughout
this function.

Signed-off-by: Mark Tinguely <mark.tinguely@oracle.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ocfs2/aops.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Joseph Qi Dec. 14, 2024, 2:08 p.m. UTC | #1
On 2024/12/6 01:16, Matthew Wilcox (Oracle) wrote:
> From: Mark Tinguely <mark.tinguely@oracle.com>
> 
> Save a couple of calls to compound_head() by using a folio throughout
> this function.
> 
> Signed-off-by: Mark Tinguely <mark.tinguely@oracle.com>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Looks good.
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> ---
>  fs/ocfs2/aops.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index aac644a0d25d..1896a1d24173 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -252,12 +252,12 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
>  	return 0;
>  }
>  
> -static int ocfs2_readpage_inline(struct inode *inode, struct page *page)
> +static int ocfs2_readpage_inline(struct inode *inode, struct folio *folio)
>  {
>  	int ret;
>  	struct buffer_head *di_bh = NULL;
>  
> -	BUG_ON(!PageLocked(page));
> +	BUG_ON(!folio_test_locked(folio));
>  	BUG_ON(!(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL));
>  
>  	ret = ocfs2_read_inode_block(inode, &di_bh);
> @@ -266,9 +266,9 @@ static int ocfs2_readpage_inline(struct inode *inode, struct page *page)
>  		goto out;
>  	}
>  
> -	ret = ocfs2_read_inline_data(inode, page, di_bh);
> +	ret = ocfs2_read_inline_data(inode, &folio->page, di_bh);
>  out:
> -	unlock_page(page);
> +	folio_unlock(folio);
>  
>  	brelse(di_bh);
>  	return ret;
> @@ -322,7 +322,7 @@ static int ocfs2_read_folio(struct file *file, struct folio *folio)
>  	}
>  
>  	if (oi->ip_dyn_features & OCFS2_INLINE_DATA_FL)
> -		ret = ocfs2_readpage_inline(inode, &folio->page);
> +		ret = ocfs2_readpage_inline(inode, folio);
>  	else
>  		ret = block_read_full_folio(folio, ocfs2_get_block);
>  	unlock = 0;
diff mbox series

Patch

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index aac644a0d25d..1896a1d24173 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -252,12 +252,12 @@  int ocfs2_read_inline_data(struct inode *inode, struct page *page,
 	return 0;
 }
 
-static int ocfs2_readpage_inline(struct inode *inode, struct page *page)
+static int ocfs2_readpage_inline(struct inode *inode, struct folio *folio)
 {
 	int ret;
 	struct buffer_head *di_bh = NULL;
 
-	BUG_ON(!PageLocked(page));
+	BUG_ON(!folio_test_locked(folio));
 	BUG_ON(!(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL));
 
 	ret = ocfs2_read_inode_block(inode, &di_bh);
@@ -266,9 +266,9 @@  static int ocfs2_readpage_inline(struct inode *inode, struct page *page)
 		goto out;
 	}
 
-	ret = ocfs2_read_inline_data(inode, page, di_bh);
+	ret = ocfs2_read_inline_data(inode, &folio->page, di_bh);
 out:
-	unlock_page(page);
+	folio_unlock(folio);
 
 	brelse(di_bh);
 	return ret;
@@ -322,7 +322,7 @@  static int ocfs2_read_folio(struct file *file, struct folio *folio)
 	}
 
 	if (oi->ip_dyn_features & OCFS2_INLINE_DATA_FL)
-		ret = ocfs2_readpage_inline(inode, &folio->page);
+		ret = ocfs2_readpage_inline(inode, folio);
 	else
 		ret = block_read_full_folio(folio, ocfs2_get_block);
 	unlock = 0;