* [PATCH 2/6] btrfs: drop usage of folio_index [not found] <20250427185908.90450-1-ryncsn@gmail.com> @ 2025-04-27 18:59 ` Kairui Song 2025-04-28 0:38 ` Matthew Wilcox 2025-04-28 0:54 ` Qu Wenruo 0 siblings, 2 replies; 4+ messages in thread From: Kairui Song @ 2025-04-27 18:59 UTC (permalink / raw) To: linux-mm Cc: Andrew Morton, Matthew Wilcox, David Hildenbrand, Hugh Dickins, Chris Li, Yosry Ahmed, Huang, Ying, Nhat Pham, Johannes Weiner, linux-kernel, Kairui Song, Chris Mason, Josef Bacik, David Sterba, linux-btrfs From: Kairui Song <kasong@tencent.com> folio_index is only needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use folio->index instead. It can't be a swap cache folio here. Swap mapping may only call into fs through `swap_rw` and that is not supported for btrfs. So just drop it and use folio->index instead. Signed-off-by: Kairui Song <kasong@tencent.com> Cc: Chris Mason <clm@fb.com> (maintainer:BTRFS FILE SYSTEM) Cc: Josef Bacik <josef@toxicpanda.com> (maintainer:BTRFS FILE SYSTEM) Cc: David Sterba <dsterba@suse.com> (maintainer:BTRFS FILE SYSTEM) Cc: linux-btrfs@vger.kernel.org (open list:BTRFS FILE SYSTEM) Signed-off-by: Kairui Song <kasong@tencent.com> --- fs/btrfs/extent_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 197f5e51c474..e08b50504d13 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3509,7 +3509,7 @@ static void btree_clear_folio_dirty_tag(struct folio *folio) xa_lock_irq(&folio->mapping->i_pages); if (!folio_test_dirty(folio)) __xa_clear_mark(&folio->mapping->i_pages, - folio_index(folio), PAGECACHE_TAG_DIRTY); + folio->index, PAGECACHE_TAG_DIRTY); xa_unlock_irq(&folio->mapping->i_pages); } -- 2.49.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/6] btrfs: drop usage of folio_index 2025-04-27 18:59 ` [PATCH 2/6] btrfs: drop usage of folio_index Kairui Song @ 2025-04-28 0:38 ` Matthew Wilcox 2025-04-28 0:54 ` Qu Wenruo 1 sibling, 0 replies; 4+ messages in thread From: Matthew Wilcox @ 2025-04-28 0:38 UTC (permalink / raw) To: Kairui Song Cc: linux-mm, Andrew Morton, David Hildenbrand, Hugh Dickins, Chris Li, Yosry Ahmed, Huang, Ying, Nhat Pham, Johannes Weiner, linux-kernel, Chris Mason, Josef Bacik, David Sterba, linux-btrfs On Mon, Apr 28, 2025 at 02:59:04AM +0800, Kairui Song wrote: > From: Kairui Song <kasong@tencent.com> > > folio_index is only needed for mixed usage of page cache and swap > cache, for pure page cache usage, the caller can just use > folio->index instead. > > It can't be a swap cache folio here. Swap mapping may only call into fs > through `swap_rw` and that is not supported for btrfs. So just drop it > and use folio->index instead. > > Signed-off-by: Kairui Song <kasong@tencent.com> > Cc: Chris Mason <clm@fb.com> (maintainer:BTRFS FILE SYSTEM) > Cc: Josef Bacik <josef@toxicpanda.com> (maintainer:BTRFS FILE SYSTEM) > Cc: David Sterba <dsterba@suse.com> (maintainer:BTRFS FILE SYSTEM) > Cc: linux-btrfs@vger.kernel.org (open list:BTRFS FILE SYSTEM) > Signed-off-by: Kairui Song <kasong@tencent.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/6] btrfs: drop usage of folio_index 2025-04-27 18:59 ` [PATCH 2/6] btrfs: drop usage of folio_index Kairui Song 2025-04-28 0:38 ` Matthew Wilcox @ 2025-04-28 0:54 ` Qu Wenruo 2025-04-28 2:14 ` Kairui Song 1 sibling, 1 reply; 4+ messages in thread From: Qu Wenruo @ 2025-04-28 0:54 UTC (permalink / raw) To: Kairui Song, linux-mm Cc: Andrew Morton, Matthew Wilcox, David Hildenbrand, Hugh Dickins, Chris Li, Yosry Ahmed, Huang, Ying, Nhat Pham, Johannes Weiner, linux-kernel, Chris Mason, Josef Bacik, David Sterba, linux-btrfs 在 2025/4/28 04:29, Kairui Song 写道: > From: Kairui Song <kasong@tencent.com> > > folio_index is only needed for mixed usage of page cache and swap > cache, for pure page cache usage, the caller can just use > folio->index instead. The patch looks good to me, but I'm afraid the next commit message is not accurate. > > It can't be a swap cache folio here. Swap mapping may only call into fs > through `swap_rw` and that is not supported for btrfs. So just drop it > and use folio->index instead. Btrfs supports swap file, it's just not through the swap_rw() callback. In this particular case, the folio belongs to the metadata (btree) inode, thus it will never be swap cache folio. With that changed, it looks good to me. Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > > Signed-off-by: Kairui Song <kasong@tencent.com> > Cc: Chris Mason <clm@fb.com> (maintainer:BTRFS FILE SYSTEM) > Cc: Josef Bacik <josef@toxicpanda.com> (maintainer:BTRFS FILE SYSTEM) > Cc: David Sterba <dsterba@suse.com> (maintainer:BTRFS FILE SYSTEM) > Cc: linux-btrfs@vger.kernel.org (open list:BTRFS FILE SYSTEM) > Signed-off-by: Kairui Song <kasong@tencent.com> > --- > fs/btrfs/extent_io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > index 197f5e51c474..e08b50504d13 100644 > --- a/fs/btrfs/extent_io.c > +++ b/fs/btrfs/extent_io.c > @@ -3509,7 +3509,7 @@ static void btree_clear_folio_dirty_tag(struct folio *folio) > xa_lock_irq(&folio->mapping->i_pages); > if (!folio_test_dirty(folio)) > __xa_clear_mark(&folio->mapping->i_pages, > - folio_index(folio), PAGECACHE_TAG_DIRTY); > + folio->index, PAGECACHE_TAG_DIRTY); > xa_unlock_irq(&folio->mapping->i_pages); > } > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/6] btrfs: drop usage of folio_index 2025-04-28 0:54 ` Qu Wenruo @ 2025-04-28 2:14 ` Kairui Song 0 siblings, 0 replies; 4+ messages in thread From: Kairui Song @ 2025-04-28 2:14 UTC (permalink / raw) To: Qu Wenruo Cc: linux-mm, Andrew Morton, Matthew Wilcox, David Hildenbrand, Hugh Dickins, Chris Li, Yosry Ahmed, Huang, Ying, Nhat Pham, Johannes Weiner, linux-kernel, Chris Mason, Josef Bacik, David Sterba, linux-btrfs On Mon, Apr 28, 2025 at 8:55 AM Qu Wenruo <quwenruo.btrfs@gmx.com> wrote: > > > > 在 2025/4/28 04:29, Kairui Song 写道: > > From: Kairui Song <kasong@tencent.com> > > > > folio_index is only needed for mixed usage of page cache and swap > > cache, for pure page cache usage, the caller can just use > > folio->index instead. > > The patch looks good to me, but I'm afraid the next commit message is > not accurate. > > > > > It can't be a swap cache folio here. Swap mapping may only call into fs > > through `swap_rw` and that is not supported for btrfs. So just drop it > > and use folio->index instead. > Thanks for the review. > Btrfs supports swap file, it's just not through the swap_rw() callback. Right, I just meant btrfs is not using `swap_rw`. Of course it supports swap files. Let me update the commit message a bit to clarify that. > > In this particular case, the folio belongs to the metadata (btree) > inode, thus it will never be swap cache folio. > > With that changed, it looks good to me. > > Reviewed-by: Qu Wenruo <wqu@suse.com> > > Thanks, > Qu > > > > > Signed-off-by: Kairui Song <kasong@tencent.com> > > Cc: Chris Mason <clm@fb.com> (maintainer:BTRFS FILE SYSTEM) > > Cc: Josef Bacik <josef@toxicpanda.com> (maintainer:BTRFS FILE SYSTEM) > > Cc: David Sterba <dsterba@suse.com> (maintainer:BTRFS FILE SYSTEM) > > Cc: linux-btrfs@vger.kernel.org (open list:BTRFS FILE SYSTEM) > > Signed-off-by: Kairui Song <kasong@tencent.com> > > --- > > fs/btrfs/extent_io.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > > index 197f5e51c474..e08b50504d13 100644 > > --- a/fs/btrfs/extent_io.c > > +++ b/fs/btrfs/extent_io.c > > @@ -3509,7 +3509,7 @@ static void btree_clear_folio_dirty_tag(struct folio *folio) > > xa_lock_irq(&folio->mapping->i_pages); > > if (!folio_test_dirty(folio)) > > __xa_clear_mark(&folio->mapping->i_pages, > > - folio_index(folio), PAGECACHE_TAG_DIRTY); > > + folio->index, PAGECACHE_TAG_DIRTY); > > xa_unlock_irq(&folio->mapping->i_pages); > > } > > > > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-28 2:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250427185908.90450-1-ryncsn@gmail.com>
2025-04-27 18:59 ` [PATCH 2/6] btrfs: drop usage of folio_index Kairui Song
2025-04-28 0:38 ` Matthew Wilcox
2025-04-28 0:54 ` Qu Wenruo
2025-04-28 2:14 ` Kairui Song
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox