* [PATCH 0/6] Filesystem page flags cleanup
@ 2024-10-02 4:01 Matthew Wilcox (Oracle)
2024-10-02 4:01 ` [PATCH 1/6] fs: Move clearing of mappedtodisk to buffer.c Matthew Wilcox (Oracle)
` (6 more replies)
0 siblings, 7 replies; 14+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-02 4:01 UTC (permalink / raw)
To: Christian Brauner
Cc: Matthew Wilcox (Oracle), linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
I think this pile of patches makes most sense to take through the VFS
tree. The first four continue the work begun in 02e1960aafac to make the
mappedtodisk/owner_2 flag available to filesystems which don't use
buffer heads. The last two remove uses of Private2 (we're achingly
close to being rid of it entirely, but that doesn't seem like it'll
land this merge window).
Matthew Wilcox (Oracle) (6):
fs: Move clearing of mappedtodisk to buffer.c
nilfs2: Convert nilfs_copy_buffer() to use folios
mm: Remove PageMappedToDisk
btrfs: Switch from using the private_2 flag to owner_2
ceph: Remove call to PagePrivate2()
migrate: Remove references to Private2
fs/btrfs/ctree.h | 13 ++++---------
fs/btrfs/inode.c | 8 ++++----
fs/btrfs/ordered-data.c | 4 ++--
fs/buffer.c | 1 +
fs/ceph/addr.c | 20 ++++++++++----------
fs/nilfs2/page.c | 22 +++++++++++-----------
include/linux/page-flags.h | 4 ++--
mm/migrate.c | 4 ++--
mm/truncate.c | 1 -
9 files changed, 36 insertions(+), 41 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/6] fs: Move clearing of mappedtodisk to buffer.c
2024-10-02 4:01 [PATCH 0/6] Filesystem page flags cleanup Matthew Wilcox (Oracle)
@ 2024-10-02 4:01 ` Matthew Wilcox (Oracle)
2024-10-03 12:10 ` Jan Kara
2024-10-02 4:01 ` [PATCH 2/6] nilfs2: Convert nilfs_copy_buffer() to use folios Matthew Wilcox (Oracle)
` (5 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-02 4:01 UTC (permalink / raw)
To: Christian Brauner
Cc: Matthew Wilcox (Oracle), linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
The mappedtodisk flag is only meaningful for buffer head based
filesystems. It should not be cleared for other filesystems. This allows
us to reuse the mappedtodisk flag to have other meanings in filesystems
that do not use buffer heads.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/buffer.c | 1 +
mm/truncate.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 1fc9a50def0b..35f9af799e0a 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1649,6 +1649,7 @@ void block_invalidate_folio(struct folio *folio, size_t offset, size_t length)
if (length == folio_size(folio))
filemap_release_folio(folio, 0);
out:
+ folio_clear_mappedtodisk(folio);
return;
}
EXPORT_SYMBOL(block_invalidate_folio);
diff --git a/mm/truncate.c b/mm/truncate.c
index 0668cd340a46..870af79fb446 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -166,7 +166,6 @@ static void truncate_cleanup_folio(struct folio *folio)
* Hence dirty accounting check is placed after invalidation.
*/
folio_cancel_dirty(folio);
- folio_clear_mappedtodisk(folio);
}
int truncate_inode_folio(struct address_space *mapping, struct folio *folio)
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/6] nilfs2: Convert nilfs_copy_buffer() to use folios
2024-10-02 4:01 [PATCH 0/6] Filesystem page flags cleanup Matthew Wilcox (Oracle)
2024-10-02 4:01 ` [PATCH 1/6] fs: Move clearing of mappedtodisk to buffer.c Matthew Wilcox (Oracle)
@ 2024-10-02 4:01 ` Matthew Wilcox (Oracle)
2024-10-02 13:11 ` Ryusuke Konishi
2024-10-02 4:01 ` [PATCH 3/6] mm: Remove PageMappedToDisk Matthew Wilcox (Oracle)
` (4 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-02 4:01 UTC (permalink / raw)
To: Christian Brauner
Cc: Matthew Wilcox (Oracle), linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
Use folio APIs instead of page APIs.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/nilfs2/page.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 9c0b7cddeaae..16bb82cdbc07 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -98,16 +98,16 @@ void nilfs_forget_buffer(struct buffer_head *bh)
*/
void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh)
{
- void *kaddr0, *kaddr1;
+ void *saddr, *daddr;
unsigned long bits;
- struct page *spage = sbh->b_page, *dpage = dbh->b_page;
+ struct folio *sfolio = sbh->b_folio, *dfolio = dbh->b_folio;
struct buffer_head *bh;
- kaddr0 = kmap_local_page(spage);
- kaddr1 = kmap_local_page(dpage);
- memcpy(kaddr1 + bh_offset(dbh), kaddr0 + bh_offset(sbh), sbh->b_size);
- kunmap_local(kaddr1);
- kunmap_local(kaddr0);
+ saddr = kmap_local_folio(sfolio, bh_offset(sbh));
+ daddr = kmap_local_folio(dfolio, bh_offset(dbh));
+ memcpy(daddr, saddr, sbh->b_size);
+ kunmap_local(daddr);
+ kunmap_local(saddr);
dbh->b_state = sbh->b_state & NILFS_BUFFER_INHERENT_BITS;
dbh->b_blocknr = sbh->b_blocknr;
@@ -121,13 +121,13 @@ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh)
unlock_buffer(bh);
}
if (bits & BIT(BH_Uptodate))
- SetPageUptodate(dpage);
+ folio_mark_uptodate(dfolio);
else
- ClearPageUptodate(dpage);
+ folio_clear_uptodate(dfolio);
if (bits & BIT(BH_Mapped))
- SetPageMappedToDisk(dpage);
+ folio_set_mappedtodisk(dfolio);
else
- ClearPageMappedToDisk(dpage);
+ folio_clear_mappedtodisk(dfolio);
}
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/6] mm: Remove PageMappedToDisk
2024-10-02 4:01 [PATCH 0/6] Filesystem page flags cleanup Matthew Wilcox (Oracle)
2024-10-02 4:01 ` [PATCH 1/6] fs: Move clearing of mappedtodisk to buffer.c Matthew Wilcox (Oracle)
2024-10-02 4:01 ` [PATCH 2/6] nilfs2: Convert nilfs_copy_buffer() to use folios Matthew Wilcox (Oracle)
@ 2024-10-02 4:01 ` Matthew Wilcox (Oracle)
2024-10-03 12:11 ` Jan Kara
2024-10-02 4:01 ` [PATCH 4/6] btrfs: Switch from using the private_2 flag to owner_2 Matthew Wilcox (Oracle)
` (3 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-02 4:01 UTC (permalink / raw)
To: Christian Brauner
Cc: Matthew Wilcox (Oracle), linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
All callers have now been converted to the folio APIs, so remove
the page API for this flag.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 1b3a76710487..35d08c30d4a6 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -554,7 +554,7 @@ FOLIO_FLAG(owner_2, FOLIO_HEAD_PAGE)
*/
TESTPAGEFLAG(Writeback, writeback, PF_NO_TAIL)
TESTSCFLAG(Writeback, writeback, PF_NO_TAIL)
-PAGEFLAG(MappedToDisk, mappedtodisk, PF_NO_TAIL)
+FOLIO_FLAG(mappedtodisk, FOLIO_HEAD_PAGE)
/* PG_readahead is only used for reads; PG_reclaim is only for writes */
PAGEFLAG(Reclaim, reclaim, PF_NO_TAIL)
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/6] btrfs: Switch from using the private_2 flag to owner_2
2024-10-02 4:01 [PATCH 0/6] Filesystem page flags cleanup Matthew Wilcox (Oracle)
` (2 preceding siblings ...)
2024-10-02 4:01 ` [PATCH 3/6] mm: Remove PageMappedToDisk Matthew Wilcox (Oracle)
@ 2024-10-02 4:01 ` Matthew Wilcox (Oracle)
2024-10-03 17:09 ` Josef Bacik
2024-10-02 4:01 ` [PATCH 5/6] ceph: Remove call to PagePrivate2() Matthew Wilcox (Oracle)
` (2 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-02 4:01 UTC (permalink / raw)
To: Christian Brauner
Cc: Matthew Wilcox (Oracle), linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
We are close to removing the private_2 flag, so switch btrfs to using
owner_2 for its ordered flag. This is mostly used by buffer head
filesystems, so btrfs can use it because it doesn't use buffer heads.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/btrfs/ctree.h | 13 ++++---------
fs/btrfs/inode.c | 8 ++++----
fs/btrfs/ordered-data.c | 4 ++--
3 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 317a3712270f..307dedf95c70 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -744,16 +744,11 @@ const char *btrfs_super_csum_driver(u16 csum_type);
size_t __attribute_const__ btrfs_get_num_csums(void);
/*
- * We use page status Private2 to indicate there is an ordered extent with
+ * We use folio flag owner_2 to indicate there is an ordered extent with
* unfinished IO.
- *
- * Rename the Private2 accessors to Ordered, to improve readability.
*/
-#define PageOrdered(page) PagePrivate2(page)
-#define SetPageOrdered(page) SetPagePrivate2(page)
-#define ClearPageOrdered(page) ClearPagePrivate2(page)
-#define folio_test_ordered(folio) folio_test_private_2(folio)
-#define folio_set_ordered(folio) folio_set_private_2(folio)
-#define folio_clear_ordered(folio) folio_clear_private_2(folio)
+#define folio_test_ordered(folio) folio_test_owner_2(folio)
+#define folio_set_ordered(folio) folio_set_owner_2(folio)
+#define folio_clear_ordered(folio) folio_clear_owner_2(folio)
#endif
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index edac499fd83d..a4055896261d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1513,7 +1513,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
* (which the caller expects to stay locked), don't clear any
* dirty bits and don't set any writeback bits
*
- * Do set the Ordered (Private2) bit so we know this page was
+ * Do set the Ordered flag so we know this page was
* properly setup for writepage.
*/
page_ops = (keep_locked ? 0 : PAGE_UNLOCK);
@@ -7292,7 +7292,7 @@ static void btrfs_invalidate_folio(struct folio *folio, size_t offset,
*
* But already submitted bio can still be finished on this folio.
* Furthermore, endio function won't skip folio which has Ordered
- * (Private2) already cleared, so it's possible for endio and
+ * already cleared, so it's possible for endio and
* invalidate_folio to do the same ordered extent accounting twice
* on one folio.
*
@@ -7358,7 +7358,7 @@ static void btrfs_invalidate_folio(struct folio *folio, size_t offset,
range_len = range_end + 1 - cur;
if (!btrfs_folio_test_ordered(fs_info, folio, cur, range_len)) {
/*
- * If Ordered (Private2) is cleared, it means endio has
+ * If Ordered is cleared, it means endio has
* already been executed for the range.
* We can't delete the extent states as
* btrfs_finish_ordered_io() may still use some of them.
@@ -7431,7 +7431,7 @@ static void btrfs_invalidate_folio(struct folio *folio, size_t offset,
}
/*
* We have iterated through all ordered extents of the page, the page
- * should not have Ordered (Private2) anymore, or the above iteration
+ * should not have Ordered anymore, or the above iteration
* did something wrong.
*/
ASSERT(!folio_test_ordered(folio));
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 2104d60c2161..95c8499a159a 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -346,10 +346,10 @@ static bool can_finish_ordered_extent(struct btrfs_ordered_extent *ordered,
ASSERT(file_offset + len <= folio_pos(folio) + folio_size(folio));
/*
- * Ordered (Private2) bit indicates whether we still have
+ * Ordered flag indicates whether we still have
* pending io unfinished for the ordered extent.
*
- * If there's no such bit, we need to skip to next range.
+ * If it's not set, we need to skip to next range.
*/
if (!btrfs_folio_test_ordered(fs_info, folio, file_offset, len))
return false;
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/6] ceph: Remove call to PagePrivate2()
2024-10-02 4:01 [PATCH 0/6] Filesystem page flags cleanup Matthew Wilcox (Oracle)
` (3 preceding siblings ...)
2024-10-02 4:01 ` [PATCH 4/6] btrfs: Switch from using the private_2 flag to owner_2 Matthew Wilcox (Oracle)
@ 2024-10-02 4:01 ` Matthew Wilcox (Oracle)
2024-10-02 4:01 ` [PATCH 6/6] migrate: Remove references to Private2 Matthew Wilcox (Oracle)
2024-10-04 7:24 ` [PATCH 0/6] Filesystem page flags cleanup Christian Brauner
6 siblings, 0 replies; 14+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-02 4:01 UTC (permalink / raw)
To: Christian Brauner
Cc: Matthew Wilcox (Oracle), linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
Use the folio that we already have to call folio_test_private_2()
instead. This is the last call to PagePrivate2(), so replace its
PAGEFLAG() definition with FOLIO_FLAG().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ceph/addr.c | 20 ++++++++++----------
include/linux/page-flags.h | 2 +-
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 53fef258c2bc..a8788e300dc7 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1051,7 +1051,9 @@ static int ceph_writepages_start(struct address_space *mapping,
if (!nr_folios && !locked_pages)
break;
for (i = 0; i < nr_folios && locked_pages < max_pages; i++) {
- page = &fbatch.folios[i]->page;
+ struct folio *folio = fbatch.folios[i];
+
+ page = &folio->page;
doutc(cl, "? %p idx %lu\n", page, page->index);
if (locked_pages == 0)
lock_page(page); /* first page */
@@ -1078,8 +1080,6 @@ static int ceph_writepages_start(struct address_space *mapping,
continue;
}
if (page_offset(page) >= ceph_wbc.i_size) {
- struct folio *folio = page_folio(page);
-
doutc(cl, "folio at %lu beyond eof %llu\n",
folio->index, ceph_wbc.i_size);
if ((ceph_wbc.size_stable ||
@@ -1095,16 +1095,16 @@ static int ceph_writepages_start(struct address_space *mapping,
unlock_page(page);
break;
}
- if (PageWriteback(page) ||
- PagePrivate2(page) /* [DEPRECATED] */) {
+ if (folio_test_writeback(folio) ||
+ folio_test_private_2(folio) /* [DEPRECATED] */) {
if (wbc->sync_mode == WB_SYNC_NONE) {
- doutc(cl, "%p under writeback\n", page);
- unlock_page(page);
+ doutc(cl, "%p under writeback\n", folio);
+ folio_unlock(folio);
continue;
}
- doutc(cl, "waiting on writeback %p\n", page);
- wait_on_page_writeback(page);
- folio_wait_private_2(page_folio(page)); /* [DEPRECATED] */
+ doutc(cl, "waiting on writeback %p\n", folio);
+ folio_wait_writeback(folio);
+ folio_wait_private_2(folio); /* [DEPRECATED] */
}
if (!clear_page_dirty_for_io(page)) {
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 35d08c30d4a6..4c2dfe289046 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -543,7 +543,7 @@ FOLIO_FLAG(swapbacked, FOLIO_HEAD_PAGE)
* - PG_private and PG_private_2 cause release_folio() and co to be invoked
*/
PAGEFLAG(Private, private, PF_ANY)
-PAGEFLAG(Private2, private_2, PF_ANY) TESTSCFLAG(Private2, private_2, PF_ANY)
+FOLIO_FLAG(private_2, FOLIO_HEAD_PAGE)
/* owner_2 can be set on tail pages for anon memory */
FOLIO_FLAG(owner_2, FOLIO_HEAD_PAGE)
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/6] migrate: Remove references to Private2
2024-10-02 4:01 [PATCH 0/6] Filesystem page flags cleanup Matthew Wilcox (Oracle)
` (4 preceding siblings ...)
2024-10-02 4:01 ` [PATCH 5/6] ceph: Remove call to PagePrivate2() Matthew Wilcox (Oracle)
@ 2024-10-02 4:01 ` Matthew Wilcox (Oracle)
2024-10-03 12:13 ` Jan Kara
2024-10-04 7:24 ` [PATCH 0/6] Filesystem page flags cleanup Christian Brauner
6 siblings, 1 reply; 14+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-02 4:01 UTC (permalink / raw)
To: Christian Brauner
Cc: Matthew Wilcox (Oracle), linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
These comments are now stale; rewrite them.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
mm/migrate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index df91248755e4..21264c24a404 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -472,7 +472,7 @@ static int folio_expected_refs(struct address_space *mapping,
* The number of remaining references must be:
* 1 for anonymous folios without a mapping
* 2 for folios with a mapping
- * 3 for folios with a mapping and PagePrivate/PagePrivate2 set.
+ * 3 for folios with a mapping and the private flag set.
*/
static int __folio_migrate_mapping(struct address_space *mapping,
struct folio *newfolio, struct folio *folio, int expected_count)
@@ -786,7 +786,7 @@ static int __migrate_folio(struct address_space *mapping, struct folio *dst,
* @mode: How to migrate the page.
*
* Common logic to directly migrate a single LRU folio suitable for
- * folios that do not use PagePrivate/PagePrivate2.
+ * folios that do not have private data.
*
* Folios are locked upon entry and exit.
*/
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 2/6] nilfs2: Convert nilfs_copy_buffer() to use folios
2024-10-02 4:01 ` [PATCH 2/6] nilfs2: Convert nilfs_copy_buffer() to use folios Matthew Wilcox (Oracle)
@ 2024-10-02 13:11 ` Ryusuke Konishi
0 siblings, 0 replies; 14+ messages in thread
From: Ryusuke Konishi @ 2024-10-02 13:11 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: Christian Brauner, linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
On Wed, Oct 2, 2024 at 1:02 PM Matthew Wilcox (Oracle) wrote:
>
> Use folio APIs instead of page APIs.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> fs/nilfs2/page.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
> index 9c0b7cddeaae..16bb82cdbc07 100644
> --- a/fs/nilfs2/page.c
> +++ b/fs/nilfs2/page.c
> @@ -98,16 +98,16 @@ void nilfs_forget_buffer(struct buffer_head *bh)
> */
> void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh)
> {
> - void *kaddr0, *kaddr1;
> + void *saddr, *daddr;
> unsigned long bits;
> - struct page *spage = sbh->b_page, *dpage = dbh->b_page;
> + struct folio *sfolio = sbh->b_folio, *dfolio = dbh->b_folio;
> struct buffer_head *bh;
>
> - kaddr0 = kmap_local_page(spage);
> - kaddr1 = kmap_local_page(dpage);
> - memcpy(kaddr1 + bh_offset(dbh), kaddr0 + bh_offset(sbh), sbh->b_size);
> - kunmap_local(kaddr1);
> - kunmap_local(kaddr0);
> + saddr = kmap_local_folio(sfolio, bh_offset(sbh));
> + daddr = kmap_local_folio(dfolio, bh_offset(dbh));
> + memcpy(daddr, saddr, sbh->b_size);
> + kunmap_local(daddr);
> + kunmap_local(saddr);
>
> dbh->b_state = sbh->b_state & NILFS_BUFFER_INHERENT_BITS;
> dbh->b_blocknr = sbh->b_blocknr;
> @@ -121,13 +121,13 @@ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh)
> unlock_buffer(bh);
> }
> if (bits & BIT(BH_Uptodate))
> - SetPageUptodate(dpage);
> + folio_mark_uptodate(dfolio);
> else
> - ClearPageUptodate(dpage);
> + folio_clear_uptodate(dfolio);
> if (bits & BIT(BH_Mapped))
> - SetPageMappedToDisk(dpage);
> + folio_set_mappedtodisk(dfolio);
> else
> - ClearPageMappedToDisk(dpage);
> + folio_clear_mappedtodisk(dfolio);
> }
>
> /**
> --
> 2.43.0
I understand the change. Also, thank you for converting this function
to be folio-based.
Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Thanks,
Ryusuke Konishi
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/6] fs: Move clearing of mappedtodisk to buffer.c
2024-10-02 4:01 ` [PATCH 1/6] fs: Move clearing of mappedtodisk to buffer.c Matthew Wilcox (Oracle)
@ 2024-10-03 12:10 ` Jan Kara
2024-10-03 14:19 ` Matthew Wilcox
0 siblings, 1 reply; 14+ messages in thread
From: Jan Kara @ 2024-10-03 12:10 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: Christian Brauner, linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
On Wed 02-10-24 05:01:03, Matthew Wilcox (Oracle) wrote:
> The mappedtodisk flag is only meaningful for buffer head based
> filesystems. It should not be cleared for other filesystems. This allows
> us to reuse the mappedtodisk flag to have other meanings in filesystems
> that do not use buffer heads.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
The patch looks good. But I'm bit confused about the changelog. There's no
generic code checking for mappedtodisk. Only nilfs2 actually uses it for
anything, all other filesystems just never look at it as far as my grepping
shows. So speaking about "filesystems that do not use buffer heads" looks
somewhat broad to me. Anyway feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/buffer.c | 1 +
> mm/truncate.c | 1 -
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 1fc9a50def0b..35f9af799e0a 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -1649,6 +1649,7 @@ void block_invalidate_folio(struct folio *folio, size_t offset, size_t length)
> if (length == folio_size(folio))
> filemap_release_folio(folio, 0);
> out:
> + folio_clear_mappedtodisk(folio);
> return;
> }
> EXPORT_SYMBOL(block_invalidate_folio);
> diff --git a/mm/truncate.c b/mm/truncate.c
> index 0668cd340a46..870af79fb446 100644
> --- a/mm/truncate.c
> +++ b/mm/truncate.c
> @@ -166,7 +166,6 @@ static void truncate_cleanup_folio(struct folio *folio)
> * Hence dirty accounting check is placed after invalidation.
> */
> folio_cancel_dirty(folio);
> - folio_clear_mappedtodisk(folio);
> }
>
> int truncate_inode_folio(struct address_space *mapping, struct folio *folio)
> --
> 2.43.0
>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/6] mm: Remove PageMappedToDisk
2024-10-02 4:01 ` [PATCH 3/6] mm: Remove PageMappedToDisk Matthew Wilcox (Oracle)
@ 2024-10-03 12:11 ` Jan Kara
0 siblings, 0 replies; 14+ messages in thread
From: Jan Kara @ 2024-10-03 12:11 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: Christian Brauner, linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
On Wed 02-10-24 05:01:05, Matthew Wilcox (Oracle) wrote:
> All callers have now been converted to the folio APIs, so remove
> the page API for this flag.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> include/linux/page-flags.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 1b3a76710487..35d08c30d4a6 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -554,7 +554,7 @@ FOLIO_FLAG(owner_2, FOLIO_HEAD_PAGE)
> */
> TESTPAGEFLAG(Writeback, writeback, PF_NO_TAIL)
> TESTSCFLAG(Writeback, writeback, PF_NO_TAIL)
> -PAGEFLAG(MappedToDisk, mappedtodisk, PF_NO_TAIL)
> +FOLIO_FLAG(mappedtodisk, FOLIO_HEAD_PAGE)
>
> /* PG_readahead is only used for reads; PG_reclaim is only for writes */
> PAGEFLAG(Reclaim, reclaim, PF_NO_TAIL)
> --
> 2.43.0
>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 6/6] migrate: Remove references to Private2
2024-10-02 4:01 ` [PATCH 6/6] migrate: Remove references to Private2 Matthew Wilcox (Oracle)
@ 2024-10-03 12:13 ` Jan Kara
0 siblings, 0 replies; 14+ messages in thread
From: Jan Kara @ 2024-10-03 12:13 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: Christian Brauner, linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
On Wed 02-10-24 05:01:08, Matthew Wilcox (Oracle) wrote:
> These comments are now stale; rewrite them.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> mm/migrate.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index df91248755e4..21264c24a404 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -472,7 +472,7 @@ static int folio_expected_refs(struct address_space *mapping,
> * The number of remaining references must be:
> * 1 for anonymous folios without a mapping
> * 2 for folios with a mapping
> - * 3 for folios with a mapping and PagePrivate/PagePrivate2 set.
> + * 3 for folios with a mapping and the private flag set.
> */
> static int __folio_migrate_mapping(struct address_space *mapping,
> struct folio *newfolio, struct folio *folio, int expected_count)
> @@ -786,7 +786,7 @@ static int __migrate_folio(struct address_space *mapping, struct folio *dst,
> * @mode: How to migrate the page.
> *
> * Common logic to directly migrate a single LRU folio suitable for
> - * folios that do not use PagePrivate/PagePrivate2.
> + * folios that do not have private data.
> *
> * Folios are locked upon entry and exit.
> */
> --
> 2.43.0
>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/6] fs: Move clearing of mappedtodisk to buffer.c
2024-10-03 12:10 ` Jan Kara
@ 2024-10-03 14:19 ` Matthew Wilcox
0 siblings, 0 replies; 14+ messages in thread
From: Matthew Wilcox @ 2024-10-03 14:19 UTC (permalink / raw)
To: Jan Kara
Cc: Christian Brauner, linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
On Thu, Oct 03, 2024 at 02:10:20PM +0200, Jan Kara wrote:
> On Wed 02-10-24 05:01:03, Matthew Wilcox (Oracle) wrote:
> > The mappedtodisk flag is only meaningful for buffer head based
> > filesystems. It should not be cleared for other filesystems. This allows
> > us to reuse the mappedtodisk flag to have other meanings in filesystems
> > that do not use buffer heads.
> >
> > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>
> The patch looks good. But I'm bit confused about the changelog. There's no
> generic code checking for mappedtodisk. Only nilfs2 actually uses it for
> anything, all other filesystems just never look at it as far as my grepping
> shows. So speaking about "filesystems that do not use buffer heads" looks
> somewhat broad to me. Anyway feel free to add:
Hmm. f2fs also uses it in page_mkwrite(). But it looks odd to me.
Perhaps we could get rid of mappedtodisk entirely ... I see ext4
used to use it until someone removed it in 9ea7df534ed2 ;-)
Anyway, what the changelog is trying to say is that only
buffer-head filesystems ever have the mappedtodisk flag set, eg by
block_read_full_folio() or do_mpage_readpage(). So it doesn't make
sense to clear it for non-buffer-head filesystems, and may inhibit their
ability to use it for unrelated purposes.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/6] btrfs: Switch from using the private_2 flag to owner_2
2024-10-02 4:01 ` [PATCH 4/6] btrfs: Switch from using the private_2 flag to owner_2 Matthew Wilcox (Oracle)
@ 2024-10-03 17:09 ` Josef Bacik
0 siblings, 0 replies; 14+ messages in thread
From: Josef Bacik @ 2024-10-03 17:09 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: Christian Brauner, linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
On Wed, Oct 02, 2024 at 05:01:06AM +0100, Matthew Wilcox (Oracle) wrote:
> We are close to removing the private_2 flag, so switch btrfs to using
> owner_2 for its ordered flag. This is mostly used by buffer head
> filesystems, so btrfs can use it because it doesn't use buffer heads.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/6] Filesystem page flags cleanup
2024-10-02 4:01 [PATCH 0/6] Filesystem page flags cleanup Matthew Wilcox (Oracle)
` (5 preceding siblings ...)
2024-10-02 4:01 ` [PATCH 6/6] migrate: Remove references to Private2 Matthew Wilcox (Oracle)
@ 2024-10-04 7:24 ` Christian Brauner
6 siblings, 0 replies; 14+ messages in thread
From: Christian Brauner @ 2024-10-04 7:24 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: Christian Brauner, linux-fsdevel, ceph-devel, linux-btrfs,
linux-nilfs, linux-mm
On Wed, 02 Oct 2024 05:01:02 +0100, Matthew Wilcox (Oracle) wrote:
> I think this pile of patches makes most sense to take through the VFS
> tree. The first four continue the work begun in 02e1960aafac to make the
> mappedtodisk/owner_2 flag available to filesystems which don't use
> buffer heads. The last two remove uses of Private2 (we're achingly
> close to being rid of it entirely, but that doesn't seem like it'll
> land this merge window).
>
> [...]
Applied to the vfs.pagecache branch of the vfs/vfs.git tree.
Patches in the vfs.pagecache branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.pagecache
[1/6] fs: Move clearing of mappedtodisk to buffer.c
https://git.kernel.org/vfs/vfs/c/9c33d85e34c2
[2/6] nilfs2: Convert nilfs_copy_buffer() to use folios
https://git.kernel.org/vfs/vfs/c/a38117bc0de6
[3/6] mm: Remove PageMappedToDisk
https://git.kernel.org/vfs/vfs/c/a04d5f82fa38
[4/6] btrfs: Switch from using the private_2 flag to owner_2
https://git.kernel.org/vfs/vfs/c/a6752a6e7fb0
[5/6] ceph: Remove call to PagePrivate2()
https://git.kernel.org/vfs/vfs/c/fd15ba4cb00a
[6/6] migrate: Remove references to Private2
https://git.kernel.org/vfs/vfs/c/7735348d9f3a
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-10-04 7:25 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02 4:01 [PATCH 0/6] Filesystem page flags cleanup Matthew Wilcox (Oracle)
2024-10-02 4:01 ` [PATCH 1/6] fs: Move clearing of mappedtodisk to buffer.c Matthew Wilcox (Oracle)
2024-10-03 12:10 ` Jan Kara
2024-10-03 14:19 ` Matthew Wilcox
2024-10-02 4:01 ` [PATCH 2/6] nilfs2: Convert nilfs_copy_buffer() to use folios Matthew Wilcox (Oracle)
2024-10-02 13:11 ` Ryusuke Konishi
2024-10-02 4:01 ` [PATCH 3/6] mm: Remove PageMappedToDisk Matthew Wilcox (Oracle)
2024-10-03 12:11 ` Jan Kara
2024-10-02 4:01 ` [PATCH 4/6] btrfs: Switch from using the private_2 flag to owner_2 Matthew Wilcox (Oracle)
2024-10-03 17:09 ` Josef Bacik
2024-10-02 4:01 ` [PATCH 5/6] ceph: Remove call to PagePrivate2() Matthew Wilcox (Oracle)
2024-10-02 4:01 ` [PATCH 6/6] migrate: Remove references to Private2 Matthew Wilcox (Oracle)
2024-10-03 12:13 ` Jan Kara
2024-10-04 7:24 ` [PATCH 0/6] Filesystem page flags cleanup Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).