From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-fsdevel@vger.kernel.org
Cc: linux-mm@kvack.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 08/11] shmem: Add shmem_writeout()
Date: Sat, 8 Mar 2025 13:31:54 +0800 [thread overview]
Message-ID: <88098e5c-1514-4d8d-a220-531a9b473ae3@linux.alibaba.com> (raw)
In-Reply-To: <20250307135414.2987755-9-willy@infradead.org>
On 2025/3/7 21:54, Matthew Wilcox (Oracle) wrote:
> This will be the replacement for shmem_writepage().
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
> include/linux/shmem_fs.h | 7 ++++---
> mm/shmem.c | 20 ++++++++++++++------
> 2 files changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
> index 0b273a7b9f01..5f03a39a26f7 100644
> --- a/include/linux/shmem_fs.h
> +++ b/include/linux/shmem_fs.h
> @@ -104,10 +104,11 @@ static inline bool shmem_mapping(struct address_space *mapping)
> return false;
> }
> #endif /* CONFIG_SHMEM */
> -extern void shmem_unlock_mapping(struct address_space *mapping);
> -extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
> +void shmem_unlock_mapping(struct address_space *mapping);
> +struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
> pgoff_t index, gfp_t gfp_mask);
> -extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
> +int shmem_writeout(struct folio *folio, struct writeback_control *wbc);
> +void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
> int shmem_unuse(unsigned int type);
>
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> diff --git a/mm/shmem.c b/mm/shmem.c
> index ba162e991285..427b7f70fffb 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1536,12 +1536,20 @@ int shmem_unuse(unsigned int type)
> return error;
> }
>
> -/*
> - * Move the page from the page cache to the swap cache.
> - */
> static int shmem_writepage(struct page *page, struct writeback_control *wbc)
> {
> - struct folio *folio = page_folio(page);
> + return shmem_writeout(page_folio(page), wbc);
> +}
> +
> +/**
> + * shmem_writeout - Write the folio to swap
> + * @folio: The folio to write
> + * @wbc: How writeback is to be done
> + *
> + * Move the folio from the page cache to the swap cache.
> + */
> +int shmem_writeout(struct folio *folio, struct writeback_control *wbc)
> +{
> struct address_space *mapping = folio->mapping;
> struct inode *inode = mapping->host;
> struct shmem_inode_info *info = SHMEM_I(inode);
> @@ -1586,9 +1594,8 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
> try_split:
> /* Ensure the subpages are still dirty */
> folio_test_set_dirty(folio);
> - if (split_huge_page_to_list_to_order(page, wbc->list, 0))
> + if (split_folio_to_list(folio, wbc->list))
> goto redirty;
> - folio = page_folio(page);
> folio_clear_dirty(folio);
> }
>
> @@ -1660,6 +1667,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
> folio_unlock(folio);
> return 0;
> }
> +EXPORT_SYMBOL_GPL(shmem_writeout);
>
> #if defined(CONFIG_NUMA) && defined(CONFIG_TMPFS)
> static void shmem_show_mpol(struct seq_file *seq, struct mempolicy *mpol)
next prev parent reply other threads:[~2025-03-08 5:32 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 13:54 [PATCH 00/11] Remove aops->writepage Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 01/11] f2fs: Remove check for ->writepage Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 02/11] f2fs: Remove f2fs_write_data_page() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 03/11] f2fs: Remove f2fs_write_meta_page() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 04/11] f2fs: Remove f2fs_write_node_page() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 05/11] vboxsf: Convert to writepages Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 06/11] migrate: Remove call to ->writepage Matthew Wilcox (Oracle)
2025-03-27 15:04 ` Zi Yan
2025-03-27 16:52 ` Matthew Wilcox
2025-03-27 17:22 ` Zi Yan
2025-04-01 13:32 ` David Hildenbrand
2025-03-07 13:54 ` [PATCH 07/11] writeback: Remove writeback_use_writepage() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 08/11] shmem: Add shmem_writeout() Matthew Wilcox (Oracle)
2025-03-08 5:31 ` Baolin Wang [this message]
2025-03-07 13:54 ` [PATCH 09/11] i915: Use writeback_iter() Matthew Wilcox (Oracle)
2025-03-07 13:54 ` [PATCH 10/11] mm: Remove swap_writepage() and shmem_writepage() Matthew Wilcox (Oracle)
2025-03-08 5:34 ` Baolin Wang
2025-03-07 13:54 ` [PATCH 11/11] fs: Remove aops->writepage Matthew Wilcox (Oracle)
2025-03-17 1:08 ` Fan Ni
2025-03-17 3:22 ` Matthew Wilcox
2025-03-17 22:30 ` Matthew Wilcox
2025-03-18 8:10 ` Thomas Hellström
2025-04-01 16:26 ` Matthew Wilcox
2025-05-02 14:33 ` Thomas Hellström
2025-03-28 9:40 ` [PATCH 00/11] " Christian Brauner
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=88098e5c-1514-4d8d-a220-531a9b473ae3@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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