[PATCH 11/15] ubifs: Convert allocate_budget() to work on a folio

Zhihao Cheng chengzhihao1 at huawei.com
Mon Jan 22 03:52:01 PST 2024


在 2024/1/21 7:08, Matthew Wilcox (Oracle) 写道:
> The one caller has a folio, so pass it in instead of the page.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy at infradead.org>
> ---
>   fs/ubifs/file.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 

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

> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index cc450afdcc47..6bc7965ce918 100644
> --- a/fs/ubifs/file.c
> +++ b/fs/ubifs/file.c
> @@ -307,7 +307,7 @@ static int write_begin_slow(struct address_space *mapping,
>   /**
>    * allocate_budget - allocate budget for 'ubifs_write_begin()'.
>    * @c: UBIFS file-system description object
> - * @page: page to allocate budget for
> + * @folio: folio to allocate budget for
>    * @ui: UBIFS inode object the page belongs to
>    * @appending: non-zero if the page is appended
>    *
> @@ -318,15 +318,15 @@ static int write_begin_slow(struct address_space *mapping,
>    *
>    * Returns: %0 in case of success and %-ENOSPC in case of failure.
>    */
> -static int allocate_budget(struct ubifs_info *c, struct page *page,
> +static int allocate_budget(struct ubifs_info *c, struct folio *folio,
>   			   struct ubifs_inode *ui, int appending)
>   {
>   	struct ubifs_budget_req req = { .fast = 1 };
>   
> -	if (PagePrivate(page)) {
> +	if (folio->private) {
>   		if (!appending)
>   			/*
> -			 * The page is dirty and we are not appending, which
> +			 * The folio is dirty and we are not appending, which
>   			 * means no budget is needed at all.
>   			 */
>   			return 0;
> @@ -350,11 +350,11 @@ static int allocate_budget(struct ubifs_info *c, struct page *page,
>   		 */
>   		req.dirtied_ino = 1;
>   	} else {
> -		if (PageChecked(page))
> +		if (folio_test_checked(folio))
>   			/*
>   			 * The page corresponds to a hole and does not
>   			 * exist on the media. So changing it makes
> -			 * make the amount of indexing information
> +			 * the amount of indexing information
>   			 * larger, and we have to budget for a new
>   			 * page.
>   			 */
> @@ -462,7 +462,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
>   		}
>   	}
>   
> -	err = allocate_budget(c, &folio->page, ui, appending);
> +	err = allocate_budget(c, folio, ui, appending);
>   	if (unlikely(err)) {
>   		ubifs_assert(c, err == -ENOSPC);
>   		/*
> 




More information about the linux-mtd mailing list