diff mbox series

[12/15] ubifs: Convert cancel_budget() to take a folio

Message ID 20240120230824.2619716-13-willy@infradead.org
State Superseded
Headers show
Series ubifs folio conversion | expand

Commit Message

Matthew Wilcox Jan. 20, 2024, 11:08 p.m. UTC
The one caller already has a folio, so pass it in instead of the page.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ubifs/file.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Zhihao Cheng Jan. 22, 2024, 12:14 p.m. UTC | #1
在 2024/1/21 7:08, Matthew Wilcox (Oracle) 写道:
> The one caller already has a folio, so pass it in instead of the page.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   fs/ubifs/file.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>

> 
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index 6bc7965ce918..f34371436a84 100644
> --- a/fs/ubifs/file.c
> +++ b/fs/ubifs/file.c
> @@ -501,14 +501,14 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
>   /**
>    * cancel_budget - cancel budget.
>    * @c: UBIFS file-system description object
> - * @page: page to cancel budget for
> + * @folio: folio to cancel budget for
>    * @ui: UBIFS inode object the page belongs to
>    * @appending: non-zero if the page is appended
>    *
>    * This is a helper function for a page write operation. It unlocks the
>    * @ui->ui_mutex in case of appending.
>    */
> -static void cancel_budget(struct ubifs_info *c, struct page *page,
> +static void cancel_budget(struct ubifs_info *c, struct folio *folio,
>   			  struct ubifs_inode *ui, int appending)
>   {
>   	if (appending) {
> @@ -516,8 +516,8 @@ static void cancel_budget(struct ubifs_info *c, struct page *page,
>   			ubifs_release_dirty_inode_budget(c, ui);
>   		mutex_unlock(&ui->ui_mutex);
>   	}
> -	if (!PagePrivate(page)) {
> -		if (PageChecked(page))
> +	if (!folio->private) {
> +		if (folio_test_checked(folio))
>   			release_new_page_budget(c);
>   		else
>   			release_existing_page_budget(c);
> @@ -550,7 +550,7 @@ static int ubifs_write_end(struct file *file, struct address_space *mapping,
>   		 */
>   		dbg_gen("copied %d instead of %d, read page and repeat",
>   			copied, len);
> -		cancel_budget(c, &folio->page, ui, appending);
> +		cancel_budget(c, folio, ui, appending);
>   		folio_clear_checked(folio);
>   
>   		/*
>
diff mbox series

Patch

diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 6bc7965ce918..f34371436a84 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -501,14 +501,14 @@  static int ubifs_write_begin(struct file *file, struct address_space *mapping,
 /**
  * cancel_budget - cancel budget.
  * @c: UBIFS file-system description object
- * @page: page to cancel budget for
+ * @folio: folio to cancel budget for
  * @ui: UBIFS inode object the page belongs to
  * @appending: non-zero if the page is appended
  *
  * This is a helper function for a page write operation. It unlocks the
  * @ui->ui_mutex in case of appending.
  */
-static void cancel_budget(struct ubifs_info *c, struct page *page,
+static void cancel_budget(struct ubifs_info *c, struct folio *folio,
 			  struct ubifs_inode *ui, int appending)
 {
 	if (appending) {
@@ -516,8 +516,8 @@  static void cancel_budget(struct ubifs_info *c, struct page *page,
 			ubifs_release_dirty_inode_budget(c, ui);
 		mutex_unlock(&ui->ui_mutex);
 	}
-	if (!PagePrivate(page)) {
-		if (PageChecked(page))
+	if (!folio->private) {
+		if (folio_test_checked(folio))
 			release_new_page_budget(c);
 		else
 			release_existing_page_budget(c);
@@ -550,7 +550,7 @@  static int ubifs_write_end(struct file *file, struct address_space *mapping,
 		 */
 		dbg_gen("copied %d instead of %d, read page and repeat",
 			copied, len);
-		cancel_budget(c, &folio->page, ui, appending);
+		cancel_budget(c, folio, ui, appending);
 		folio_clear_checked(folio);
 
 		/*