From: Zhihao Cheng <chengzhihao1@huawei.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Richard Weinberger <richard@nod.at>
Cc: <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH 13/15] ubifs: Pass a folio into ubifs_bulk_read() and ubifs_do_bulk_read()
Date: Mon, 22 Jan 2024 20:15:16 +0800 [thread overview]
Message-ID: <882c8aaf-cdc1-cda4-9ea5-62cea681d7d9@huawei.com> (raw)
In-Reply-To: <20240120230824.2619716-14-willy@infradead.org>
在 2024/1/21 7:08, Matthew Wilcox (Oracle) 写道:
> This saves a single call to compound_head().
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> fs/ubifs/file.c | 28 +++++++++++++---------------
> 1 file changed, 13 insertions(+), 15 deletions(-)
>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index f34371436a84..8cad1fe9c50f 100644
> --- a/fs/ubifs/file.c
> +++ b/fs/ubifs/file.c
> @@ -705,15 +705,15 @@ static int populate_page(struct ubifs_info *c, struct page *page,
> * ubifs_do_bulk_read - do bulk-read.
> * @c: UBIFS file-system description object
> * @bu: bulk-read information
> - * @page1: first page to read
> + * @folio1: first folio to read
> *
> * Returns: %1 if the bulk-read is done, otherwise %0 is returned.
> */
> static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
> - struct page *page1)
> + struct folio *folio1)
> {
> - pgoff_t offset = page1->index, end_index;
> - struct address_space *mapping = page1->mapping;
> + pgoff_t offset = folio1->index, end_index;
> + struct address_space *mapping = folio1->mapping;
> struct inode *inode = mapping->host;
> struct ubifs_inode *ui = ubifs_inode(inode);
> int err, page_idx, page_cnt, ret = 0, n = 0;
> @@ -763,11 +763,11 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
> goto out_warn;
> }
>
> - err = populate_page(c, page1, bu, &n);
> + err = populate_page(c, &folio1->page, bu, &n);
> if (err)
> goto out_warn;
>
> - unlock_page(page1);
> + folio_unlock(folio1);
> ret = 1;
>
> isize = i_size_read(inode);
> @@ -812,7 +812,7 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
>
> /**
> * ubifs_bulk_read - determine whether to bulk-read and, if so, do it.
> - * @page: page from which to start bulk-read.
> + * @folio: folio from which to start bulk-read.
> *
> * Some flash media are capable of reading sequentially at faster rates. UBIFS
> * bulk-read facility is designed to take advantage of that, by reading in one
> @@ -821,12 +821,12 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
> *
> * Returns: %1 if a bulk-read is done and %0 otherwise.
> */
> -static int ubifs_bulk_read(struct page *page)
> +static int ubifs_bulk_read(struct folio *folio)
> {
> - struct inode *inode = page->mapping->host;
> + struct inode *inode = folio->mapping->host;
> struct ubifs_info *c = inode->i_sb->s_fs_info;
> struct ubifs_inode *ui = ubifs_inode(inode);
> - pgoff_t index = page->index, last_page_read = ui->last_page_read;
> + pgoff_t index = folio->index, last_page_read = ui->last_page_read;
> struct bu_info *bu;
> int err = 0, allocated = 0;
>
> @@ -874,8 +874,8 @@ static int ubifs_bulk_read(struct page *page)
>
> bu->buf_len = c->max_bu_buf_len;
> data_key_init(c, &bu->key, inode->i_ino,
> - page->index << UBIFS_BLOCKS_PER_PAGE_SHIFT);
> - err = ubifs_do_bulk_read(c, bu, page);
> + folio->index << UBIFS_BLOCKS_PER_PAGE_SHIFT);
> + err = ubifs_do_bulk_read(c, bu, folio);
>
> if (!allocated)
> mutex_unlock(&c->bu_mutex);
> @@ -889,9 +889,7 @@ static int ubifs_bulk_read(struct page *page)
>
> static int ubifs_read_folio(struct file *file, struct folio *folio)
> {
> - struct page *page = &folio->page;
> -
> - if (ubifs_bulk_read(page))
> + if (ubifs_bulk_read(folio))
> return 0;
> do_readpage(folio);
> folio_unlock(folio);
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2024-01-22 12:15 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-20 23:08 [PATCH 00/15] ubifs folio conversion Matthew Wilcox (Oracle)
2024-01-20 23:08 ` [PATCH 01/15] ubifs: Set page uptodate in the correct place Matthew Wilcox (Oracle)
2024-01-22 7:22 ` Zhihao Cheng
2024-01-22 14:40 ` Matthew Wilcox
2024-01-23 2:36 ` Zhihao Cheng
2024-01-24 5:01 ` Matthew Wilcox
2024-01-20 23:08 ` [PATCH 02/15] ubifs: Convert from writepage to writepages Matthew Wilcox (Oracle)
2024-01-22 11:31 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 03/15] ubifs: Convert ubifs_writepage to use a folio Matthew Wilcox (Oracle)
2024-01-22 9:27 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 04/15] ubifs: Use a folio in do_truncation() Matthew Wilcox (Oracle)
2024-01-22 9:31 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 05/15] ubifs: Convert do_writepage() to take a folio Matthew Wilcox (Oracle)
2024-01-22 11:31 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 06/15] ubifs: Convert ubifs_vm_page_mkwrite() to use " Matthew Wilcox (Oracle)
2024-01-22 11:38 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 07/15] ubifs: Convert write_begin_slow() " Matthew Wilcox (Oracle)
2024-01-20 23:08 ` [PATCH 08/15] ubifs: Convert ubifs_write_begin() " Matthew Wilcox (Oracle)
2024-01-22 11:51 ` Zhihao Cheng
2024-01-22 14:43 ` Matthew Wilcox
2024-01-23 2:15 ` Zhihao Cheng
2024-01-23 3:07 ` Matthew Wilcox
2024-01-23 4:27 ` Zhihao Cheng
2024-01-23 4:27 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 09/15] ubifs: Convert ubifs_write_end() " Matthew Wilcox (Oracle)
2024-01-23 4:39 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 10/15] ubifs: Convert do_readpage() to take " Matthew Wilcox (Oracle)
2024-01-22 12:09 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 11/15] ubifs: Convert allocate_budget() to work on " Matthew Wilcox (Oracle)
2024-01-22 11:52 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 12/15] ubifs: Convert cancel_budget() to take " Matthew Wilcox (Oracle)
2024-01-22 12:14 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 13/15] ubifs: Pass a folio into ubifs_bulk_read() and ubifs_do_bulk_read() Matthew Wilcox (Oracle)
2024-01-22 12:15 ` Zhihao Cheng [this message]
2024-01-20 23:08 ` [PATCH 14/15] ubifs: Use a folio in ubifs_do_bulk_read() Matthew Wilcox (Oracle)
2024-01-22 12:17 ` Zhihao Cheng
2024-01-20 23:08 ` [PATCH 15/15] ubifs: Convert populate_page() to take a folio Matthew Wilcox (Oracle)
2024-01-22 12:22 ` Zhihao Cheng
2024-01-23 7:33 ` [PATCH 00/15] ubifs folio conversion Richard Weinberger
2024-01-24 5:01 ` Matthew Wilcox
2024-01-25 2:05 ` Zhihao Cheng
2024-02-15 20:46 ` Matthew Wilcox
2024-02-15 20:54 ` Richard Weinberger
2024-02-25 22:13 ` Richard Weinberger
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=882c8aaf-cdc1-cda4-9ea5-62cea681d7d9@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--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