* [PATCH 0/2] fs/dax: Clean up busy page lookup helpers
@ 2026-09-04 15:27 Kaitao Cheng
2026-09-04 15:27 ` [PATCH 1/2] fs/dax: Remove unused dax_layout_busy_page() Kaitao Cheng
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Kaitao Cheng @ 2026-09-04 15:27 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Jan Kara, Dan Williams,
Matthew Wilcox
Cc: Muchun Song, linux-fsdevel, nvdimm, linux-kernel, Kaitao Cheng
The dax_layout_busy_page() and dax_layout_busy_page_range() helpers were
originally exposed so filesystems could find pinned DAX pages before
changing file layouts. Filesystem callers now use dax_break_layout(),
which provides the complete operation, leaving no direct users of these
lookup helpers outside fs/dax.c.
Remove the unused whole-mapping wrapper and make the remaining range
helper private to fs/dax.c. This reduces the exported DAX interface with
no functional change.
Kaitao Cheng (2):
fs/dax: Remove unused dax_layout_busy_page()
fs/dax: Make dax_layout_busy_page_range() static
fs/dax.c | 24 ++++++++----------------
include/linux/dax.h | 12 ------------
2 files changed, 8 insertions(+), 28 deletions(-)
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] fs/dax: Remove unused dax_layout_busy_page() 2026-09-04 15:27 [PATCH 0/2] fs/dax: Clean up busy page lookup helpers Kaitao Cheng @ 2026-09-04 15:27 ` Kaitao Cheng 2026-09-05 2:03 ` Muchun Song 2026-09-07 8:21 ` Jan Kara 2026-09-04 15:27 ` [PATCH 2/2] fs/dax: Make dax_layout_busy_page_range() static Kaitao Cheng 2026-09-10 8:05 ` [PATCH 0/2] fs/dax: Clean up busy page lookup helpers Christian Brauner 2 siblings, 2 replies; 8+ messages in thread From: Kaitao Cheng @ 2026-09-04 15:27 UTC (permalink / raw) To: Alexander Viro, Christian Brauner, Jan Kara, Dan Williams, Matthew Wilcox Cc: Muchun Song, linux-fsdevel, nvdimm, linux-kernel, Kaitao Cheng From: Kaitao Cheng <chengkaitao@kylinos.cn> dax_layout_busy_page() used to let filesystems scan an entire DAX mapping for pinned pages. All callers now use dax_break_layout(), which also handles waiting for busy pages and deleting DAX mapping entries once the range becomes idle. The remaining function is only a wrapper around dax_layout_busy_page_range() and has no in-tree users. Remove it together with its declaration, !CONFIG_FS_DAX stub, and exported symbol. Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn> --- fs/dax.c | 6 ------ include/linux/dax.h | 6 ------ 2 files changed, 12 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index dad4efea7964..1e19e4a354ce 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -841,12 +841,6 @@ struct page *dax_layout_busy_page_range(struct address_space *mapping, } EXPORT_SYMBOL_GPL(dax_layout_busy_page_range); -struct page *dax_layout_busy_page(struct address_space *mapping) -{ - return dax_layout_busy_page_range(mapping, 0, LLONG_MAX); -} -EXPORT_SYMBOL_GPL(dax_layout_busy_page); - static int __dax_invalidate_entry(struct address_space *mapping, pgoff_t index, bool trunc) { diff --git a/include/linux/dax.h b/include/linux/dax.h index fe6c3ded1b50..05e59e45a1c2 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -155,7 +155,6 @@ int dax_writeback_mapping_range(struct address_space *mapping, struct dax_device *dax_dev, struct writeback_control *wbc); int dax_folio_reset_order(struct folio *folio); -struct page *dax_layout_busy_page(struct address_space *mapping); struct page *dax_layout_busy_page_range(struct address_space *mapping, loff_t start, loff_t end); dax_entry_t dax_lock_folio(struct folio *folio); void dax_unlock_folio(struct folio *folio, dax_entry_t cookie); @@ -173,11 +172,6 @@ static inline int fs_dax_get(struct dax_device *dax_dev, void *holder, { return -EOPNOTSUPP; } -static inline struct page *dax_layout_busy_page(struct address_space *mapping) -{ - return NULL; -} - static inline struct page *dax_layout_busy_page_range(struct address_space *mapping, pgoff_t start, pgoff_t nr_pages) { return NULL; -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] fs/dax: Remove unused dax_layout_busy_page() 2026-09-04 15:27 ` [PATCH 1/2] fs/dax: Remove unused dax_layout_busy_page() Kaitao Cheng @ 2026-09-05 2:03 ` Muchun Song 2026-09-07 8:21 ` Jan Kara 1 sibling, 0 replies; 8+ messages in thread From: Muchun Song @ 2026-09-05 2:03 UTC (permalink / raw) To: Kaitao Cheng Cc: Alexander Viro, Christian Brauner, Jan Kara, Dan Williams, Matthew Wilcox, linux-fsdevel, nvdimm, linux-kernel, Kaitao Cheng > On Sep 4, 2026, at 23:27, Kaitao Cheng <kaitao.cheng@linux.dev> wrote: > > From: Kaitao Cheng <chengkaitao@kylinos.cn> > > dax_layout_busy_page() used to let filesystems scan an entire DAX > mapping for pinned pages. All callers now use dax_break_layout(), > which also handles waiting for busy pages and deleting DAX mapping > entries once the range becomes idle. > > The remaining function is only a wrapper around > dax_layout_busy_page_range() and has no in-tree users. Remove it > together with its declaration, !CONFIG_FS_DAX stub, and exported > symbol. > > Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn> Acked-by: Muchun Song <muchun.song@linux.dev> Thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] fs/dax: Remove unused dax_layout_busy_page() 2026-09-04 15:27 ` [PATCH 1/2] fs/dax: Remove unused dax_layout_busy_page() Kaitao Cheng 2026-09-05 2:03 ` Muchun Song @ 2026-09-07 8:21 ` Jan Kara 1 sibling, 0 replies; 8+ messages in thread From: Jan Kara @ 2026-09-07 8:21 UTC (permalink / raw) To: Kaitao Cheng Cc: Alexander Viro, Christian Brauner, Jan Kara, Dan Williams, Matthew Wilcox, Muchun Song, linux-fsdevel, nvdimm, linux-kernel, Kaitao Cheng On Fri 04-09-26 23:27:48, Kaitao Cheng wrote: > From: Kaitao Cheng <chengkaitao@kylinos.cn> > > dax_layout_busy_page() used to let filesystems scan an entire DAX > mapping for pinned pages. All callers now use dax_break_layout(), > which also handles waiting for busy pages and deleting DAX mapping > entries once the range becomes idle. > > The remaining function is only a wrapper around > dax_layout_busy_page_range() and has no in-tree users. Remove it > together with its declaration, !CONFIG_FS_DAX stub, and exported > symbol. > > Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/dax.c | 6 ------ > include/linux/dax.h | 6 ------ > 2 files changed, 12 deletions(-) > > diff --git a/fs/dax.c b/fs/dax.c > index dad4efea7964..1e19e4a354ce 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -841,12 +841,6 @@ struct page *dax_layout_busy_page_range(struct address_space *mapping, > } > EXPORT_SYMBOL_GPL(dax_layout_busy_page_range); > > -struct page *dax_layout_busy_page(struct address_space *mapping) > -{ > - return dax_layout_busy_page_range(mapping, 0, LLONG_MAX); > -} > -EXPORT_SYMBOL_GPL(dax_layout_busy_page); > - > static int __dax_invalidate_entry(struct address_space *mapping, > pgoff_t index, bool trunc) > { > diff --git a/include/linux/dax.h b/include/linux/dax.h > index fe6c3ded1b50..05e59e45a1c2 100644 > --- a/include/linux/dax.h > +++ b/include/linux/dax.h > @@ -155,7 +155,6 @@ int dax_writeback_mapping_range(struct address_space *mapping, > struct dax_device *dax_dev, struct writeback_control *wbc); > int dax_folio_reset_order(struct folio *folio); > > -struct page *dax_layout_busy_page(struct address_space *mapping); > struct page *dax_layout_busy_page_range(struct address_space *mapping, loff_t start, loff_t end); > dax_entry_t dax_lock_folio(struct folio *folio); > void dax_unlock_folio(struct folio *folio, dax_entry_t cookie); > @@ -173,11 +172,6 @@ static inline int fs_dax_get(struct dax_device *dax_dev, void *holder, > { > return -EOPNOTSUPP; > } > -static inline struct page *dax_layout_busy_page(struct address_space *mapping) > -{ > - return NULL; > -} > - > static inline struct page *dax_layout_busy_page_range(struct address_space *mapping, pgoff_t start, pgoff_t nr_pages) > { > return NULL; > -- > 2.50.1 (Apple Git-155) > -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] fs/dax: Make dax_layout_busy_page_range() static 2026-09-04 15:27 [PATCH 0/2] fs/dax: Clean up busy page lookup helpers Kaitao Cheng 2026-09-04 15:27 ` [PATCH 1/2] fs/dax: Remove unused dax_layout_busy_page() Kaitao Cheng @ 2026-09-04 15:27 ` Kaitao Cheng 2026-09-05 2:04 ` Muchun Song 2026-09-07 8:22 ` Jan Kara 2026-09-10 8:05 ` [PATCH 0/2] fs/dax: Clean up busy page lookup helpers Christian Brauner 2 siblings, 2 replies; 8+ messages in thread From: Kaitao Cheng @ 2026-09-04 15:27 UTC (permalink / raw) To: Alexander Viro, Christian Brauner, Jan Kara, Dan Williams, Matthew Wilcox Cc: Muchun Song, linux-fsdevel, nvdimm, linux-kernel, Kaitao Cheng From: Kaitao Cheng <chengkaitao@kylinos.cn> dax_layout_busy_page_range() no longer has callers outside fs/dax.c. Keeping the range helper exported unnecessarily exposes a low-level implementation detail. Make the helper static and remove its export and header definitions. Also fix the stale dax_layout_busy_page_range() comment to match the implementation. Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn> --- fs/dax.c | 18 ++++++++---------- include/linux/dax.h | 6 ------ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 1e19e4a354ce..c6ad9533aa54 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -770,24 +770,23 @@ static void *grab_mapping_entry(struct xa_state *xas, /** * dax_layout_busy_page_range - find first pinned page in @mapping - * @mapping: address space to scan for a page with ref count > 1 + * @mapping: address space to scan for a pinned page * @start: Starting offset. Page containing 'start' is included. * @end: End offset. Page containing 'end' is included. If 'end' is LLONG_MAX, * pages from 'start' till the end of file are included. * - * DAX requires ZONE_DEVICE mapped pages. These pages are never - * 'onlined' to the page allocator so they are considered idle when - * page->count == 1. A filesystem uses this interface to determine if - * any page in the mapping is busy, i.e. for DMA, or other - * get_user_pages() usages. + * DAX requires ZONE_DEVICE mapped pages. A page is considered busy when + * folio_ref_count(folio) exceeds folio_mapcount(folio). This helper is + * used to determine if any page in the mapping is busy, i.e. for DMA, + * or other get_user_pages() usages. * * It is expected that the filesystem is holding locks to block the * establishment of new mappings in this address_space. I.e. it expects - * to be able to run unmap_mapping_range() and subsequently not race + * to be able to run unmap_mapping_pages() and subsequently not race * mapping_mapped() becoming true. */ -struct page *dax_layout_busy_page_range(struct address_space *mapping, - loff_t start, loff_t end) +static struct page *dax_layout_busy_page_range(struct address_space *mapping, + loff_t start, loff_t end) { void *entry; unsigned int scanned = 0; @@ -839,7 +838,6 @@ struct page *dax_layout_busy_page_range(struct address_space *mapping, xas_unlock_irq(&xas); return page; } -EXPORT_SYMBOL_GPL(dax_layout_busy_page_range); static int __dax_invalidate_entry(struct address_space *mapping, pgoff_t index, bool trunc) diff --git a/include/linux/dax.h b/include/linux/dax.h index 05e59e45a1c2..f2d47975d905 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -155,7 +155,6 @@ int dax_writeback_mapping_range(struct address_space *mapping, struct dax_device *dax_dev, struct writeback_control *wbc); int dax_folio_reset_order(struct folio *folio); -struct page *dax_layout_busy_page_range(struct address_space *mapping, loff_t start, loff_t end); dax_entry_t dax_lock_folio(struct folio *folio); void dax_unlock_folio(struct folio *folio, dax_entry_t cookie); dax_entry_t dax_lock_mapping_entry(struct address_space *mapping, @@ -172,11 +171,6 @@ static inline int fs_dax_get(struct dax_device *dax_dev, void *holder, { return -EOPNOTSUPP; } -static inline struct page *dax_layout_busy_page_range(struct address_space *mapping, pgoff_t start, pgoff_t nr_pages) -{ - return NULL; -} - static inline int dax_writeback_mapping_range(struct address_space *mapping, struct dax_device *dax_dev, struct writeback_control *wbc) { -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] fs/dax: Make dax_layout_busy_page_range() static 2026-09-04 15:27 ` [PATCH 2/2] fs/dax: Make dax_layout_busy_page_range() static Kaitao Cheng @ 2026-09-05 2:04 ` Muchun Song 2026-09-07 8:22 ` Jan Kara 1 sibling, 0 replies; 8+ messages in thread From: Muchun Song @ 2026-09-05 2:04 UTC (permalink / raw) To: Kaitao Cheng Cc: Alexander Viro, Christian Brauner, Jan Kara, Dan Williams, Matthew Wilcox, linux-fsdevel, nvdimm, linux-kernel, Kaitao Cheng > On Sep 4, 2026, at 23:27, Kaitao Cheng <kaitao.cheng@linux.dev> wrote: > > From: Kaitao Cheng <chengkaitao@kylinos.cn> > > dax_layout_busy_page_range() no longer has callers outside fs/dax.c. > Keeping the range helper exported unnecessarily exposes a low-level > implementation detail. > > Make the helper static and remove its export and header definitions. > > Also fix the stale dax_layout_busy_page_range() comment to match the > implementation. > > Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn> Acked-by: Muchun Song <muchun.song@linux.dev> Thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] fs/dax: Make dax_layout_busy_page_range() static 2026-09-04 15:27 ` [PATCH 2/2] fs/dax: Make dax_layout_busy_page_range() static Kaitao Cheng 2026-09-05 2:04 ` Muchun Song @ 2026-09-07 8:22 ` Jan Kara 1 sibling, 0 replies; 8+ messages in thread From: Jan Kara @ 2026-09-07 8:22 UTC (permalink / raw) To: Kaitao Cheng Cc: Alexander Viro, Christian Brauner, Jan Kara, Dan Williams, Matthew Wilcox, Muchun Song, linux-fsdevel, nvdimm, linux-kernel, Kaitao Cheng On Fri 04-09-26 23:27:49, Kaitao Cheng wrote: > From: Kaitao Cheng <chengkaitao@kylinos.cn> > > dax_layout_busy_page_range() no longer has callers outside fs/dax.c. > Keeping the range helper exported unnecessarily exposes a low-level > implementation detail. > > Make the helper static and remove its export and header definitions. > > Also fix the stale dax_layout_busy_page_range() comment to match the > implementation. > > Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/dax.c | 18 ++++++++---------- > include/linux/dax.h | 6 ------ > 2 files changed, 8 insertions(+), 16 deletions(-) > > diff --git a/fs/dax.c b/fs/dax.c > index 1e19e4a354ce..c6ad9533aa54 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -770,24 +770,23 @@ static void *grab_mapping_entry(struct xa_state *xas, > > /** > * dax_layout_busy_page_range - find first pinned page in @mapping > - * @mapping: address space to scan for a page with ref count > 1 > + * @mapping: address space to scan for a pinned page > * @start: Starting offset. Page containing 'start' is included. > * @end: End offset. Page containing 'end' is included. If 'end' is LLONG_MAX, > * pages from 'start' till the end of file are included. > * > - * DAX requires ZONE_DEVICE mapped pages. These pages are never > - * 'onlined' to the page allocator so they are considered idle when > - * page->count == 1. A filesystem uses this interface to determine if > - * any page in the mapping is busy, i.e. for DMA, or other > - * get_user_pages() usages. > + * DAX requires ZONE_DEVICE mapped pages. A page is considered busy when > + * folio_ref_count(folio) exceeds folio_mapcount(folio). This helper is > + * used to determine if any page in the mapping is busy, i.e. for DMA, > + * or other get_user_pages() usages. > * > * It is expected that the filesystem is holding locks to block the > * establishment of new mappings in this address_space. I.e. it expects > - * to be able to run unmap_mapping_range() and subsequently not race > + * to be able to run unmap_mapping_pages() and subsequently not race > * mapping_mapped() becoming true. > */ > -struct page *dax_layout_busy_page_range(struct address_space *mapping, > - loff_t start, loff_t end) > +static struct page *dax_layout_busy_page_range(struct address_space *mapping, > + loff_t start, loff_t end) > { > void *entry; > unsigned int scanned = 0; > @@ -839,7 +838,6 @@ struct page *dax_layout_busy_page_range(struct address_space *mapping, > xas_unlock_irq(&xas); > return page; > } > -EXPORT_SYMBOL_GPL(dax_layout_busy_page_range); > > static int __dax_invalidate_entry(struct address_space *mapping, > pgoff_t index, bool trunc) > diff --git a/include/linux/dax.h b/include/linux/dax.h > index 05e59e45a1c2..f2d47975d905 100644 > --- a/include/linux/dax.h > +++ b/include/linux/dax.h > @@ -155,7 +155,6 @@ int dax_writeback_mapping_range(struct address_space *mapping, > struct dax_device *dax_dev, struct writeback_control *wbc); > int dax_folio_reset_order(struct folio *folio); > > -struct page *dax_layout_busy_page_range(struct address_space *mapping, loff_t start, loff_t end); > dax_entry_t dax_lock_folio(struct folio *folio); > void dax_unlock_folio(struct folio *folio, dax_entry_t cookie); > dax_entry_t dax_lock_mapping_entry(struct address_space *mapping, > @@ -172,11 +171,6 @@ static inline int fs_dax_get(struct dax_device *dax_dev, void *holder, > { > return -EOPNOTSUPP; > } > -static inline struct page *dax_layout_busy_page_range(struct address_space *mapping, pgoff_t start, pgoff_t nr_pages) > -{ > - return NULL; > -} > - > static inline int dax_writeback_mapping_range(struct address_space *mapping, > struct dax_device *dax_dev, struct writeback_control *wbc) > { > -- > 2.50.1 (Apple Git-155) > -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] fs/dax: Clean up busy page lookup helpers 2026-09-04 15:27 [PATCH 0/2] fs/dax: Clean up busy page lookup helpers Kaitao Cheng 2026-09-04 15:27 ` [PATCH 1/2] fs/dax: Remove unused dax_layout_busy_page() Kaitao Cheng 2026-09-04 15:27 ` [PATCH 2/2] fs/dax: Make dax_layout_busy_page_range() static Kaitao Cheng @ 2026-09-10 8:05 ` Christian Brauner 2 siblings, 0 replies; 8+ messages in thread From: Christian Brauner @ 2026-09-10 8:05 UTC (permalink / raw) To: Alexander Viro, Jan Kara, Dan Williams, Matthew Wilcox, Kaitao Cheng Cc: Muchun Song, linux-fsdevel, nvdimm, linux-kernel On Fri, 04 Sep 2026 23:27:47 +0800, Kaitao Cheng wrote: > fs/dax: Clean up busy page lookup helpers > > The dax_layout_busy_page() and dax_layout_busy_page_range() helpers were > originally exposed so filesystems could find pinned DAX pages before > changing file layouts. Filesystem callers now use dax_break_layout(), > which provides the complete operation, leaving no direct users of these > lookup helpers outside fs/dax.c. > > [...] Applied to the vfs-7.4.misc branch of the vfs/vfs.git tree. Patches in the vfs-7.4.misc 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-7.4.misc [1/2] fs/dax: Remove unused dax_layout_busy_page() https://git.kernel.org/vfs/vfs/c/cc939930c450 [2/2] fs/dax: Make dax_layout_busy_page_range() static https://git.kernel.org/vfs/vfs/c/24bf180c869b ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-09-10 8:05 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-09-04 15:27 [PATCH 0/2] fs/dax: Clean up busy page lookup helpers Kaitao Cheng 2026-09-04 15:27 ` [PATCH 1/2] fs/dax: Remove unused dax_layout_busy_page() Kaitao Cheng 2026-09-05 2:03 ` Muchun Song 2026-09-07 8:21 ` Jan Kara 2026-09-04 15:27 ` [PATCH 2/2] fs/dax: Make dax_layout_busy_page_range() static Kaitao Cheng 2026-09-05 2:04 ` Muchun Song 2026-09-07 8:22 ` Jan Kara 2026-09-10 8:05 ` [PATCH 0/2] fs/dax: Clean up busy page lookup helpers Christian Brauner
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.