linux-um archives
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Li Zetao <lizetao1@huawei.com>
Cc: anton ivanov <anton.ivanov@cambridgegreys.com>,
	 Johannes Berg <johannes@sipsolutions.net>,
	 linux-um <linux-um@lists.infradead.org>,
	 linux-kernel <linux-kernel@vger.kernel.org>,
	willy@infradead.org
Subject: Re: [PATCH -next] hostfs: Convert hostfs_writepage to use folio
Date: Thu, 12 Sep 2024 20:22:48 +0200 (CEST)	[thread overview]
Message-ID: <731546887.37035.1726165368713.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20240820025045.13339-1-lizetao1@huawei.com>

----- Ursprüngliche Mail -----
> Von: "Li Zetao" <lizetao1@huawei.com>
> An: "richard" <richard@nod.at>, "anton ivanov" <anton.ivanov@cambridgegreys.com>, "Johannes Berg"
> <johannes@sipsolutions.net>
> CC: lizetao1@huawei.com, "linux-um" <linux-um@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org>
> Gesendet: Dienstag, 20. August 2024 04:50:45
> Betreff: [PATCH -next] hostfs: Convert hostfs_writepage to use folio

> convert to use folio, so that we can get rid of 'page->index' to
> prepare for removal of 'index' field in structure page [1].
> 
> [1]: https://lore.kernel.org/all/Zp8fgUSIBGQ1TN0D@casper.infradead.org/
> 
> Cc: Matthew Wilcox <willy@infradead.org>

You patch submission didn't CC Matthew. Adding him now.

> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
> fs/hostfs/hostfs_kern.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
> index 6d1cf2436ead..e17e70f20fa1 100644
> --- a/fs/hostfs/hostfs_kern.c
> +++ b/fs/hostfs/hostfs_kern.c
> @@ -411,18 +411,19 @@ static const struct file_operations hostfs_dir_fops = {
> 
> static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
> {
> -	struct address_space *mapping = page->mapping;
> -	struct inode *inode = mapping->host;
> +	struct folio *folio = page_folio(page);
> +	struct address_space *mapping = folio->mapping;
> +	struct inode *inode = folio_inode(folio);
> 	char *buffer;
> -	loff_t base = page_offset(page);
> +	loff_t base = folio_pos(folio);
> 	int count = PAGE_SIZE;
> 	int end_index = inode->i_size >> PAGE_SHIFT;
> 	int err;
> 
> -	if (page->index >= end_index)
> +	if (folio->index >= end_index)
> 		count = inode->i_size & (PAGE_SIZE-1);
> 
> -	buffer = kmap_local_page(page);
> +	buffer = kmap_local_folio(folio, 0);
> 
> 	err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count);
> 	if (err != count) {
> @@ -439,7 +440,7 @@ static int hostfs_writepage(struct page *page, struct
> writeback_control *wbc)
> 
>  out:
> 	kunmap_local(buffer);
> -	unlock_page(page);
> +	folio_unlock(folio);
> 
> 	return err;
> }
> --
> 2.34.1


  reply	other threads:[~2024-09-12 18:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  2:50 [PATCH -next] hostfs: Convert hostfs_writepage to use folio Li Zetao
2024-09-12 18:22 ` Richard Weinberger [this message]
2024-09-12 18:36   ` Matthew Wilcox
2024-09-12 19:37     ` 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=731546887.37035.1726165368713.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=lizetao1@huawei.com \
    --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