Re: [PATCH v6 05/26] fs/dax: Create a common implementation to break DAX layouts
From: Dan Williams
Date: Mon Jan 13 2025 - 19:20:09 EST
Alistair Popple wrote:
> Prior to freeing a block file systems supporting FS DAX must check
> that the associated pages are both unmapped from user-space and not
> undergoing DMA or other access from eg. get_user_pages(). This is
> achieved by unmapping the file range and scanning the FS DAX
> page-cache to see if any pages within the mapping have an elevated
> refcount.
>
> This is done using two functions - dax_layout_busy_page_range() which
> returns a page to wait for the refcount to become idle on. Rather than
> open-code this introduce a common implementation to both unmap and
> wait for the page to become idle.
>
> Signed-off-by: Alistair Popple <apopple@xxxxxxxxxx>
>
> ---
>
> Changes for v5:
>
> - Don't wait for idle pages on non-DAX mappings
>
> Changes for v4:
>
> - Fixed some build breakage due to missing symbol exports reported by
> John Hubbard (thanks!).
[..]
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index cc1acb1..ee8e83f 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3917,15 +3917,7 @@ int ext4_break_layouts(struct inode *inode)
> if (WARN_ON_ONCE(!rwsem_is_locked(&inode->i_mapping->invalidate_lock)))
> return -EINVAL;
>
> - do {
> - page = dax_layout_busy_page(inode->i_mapping);
> - if (!page)
> - return 0;
> -
> - error = dax_wait_page_idle(page, ext4_wait_dax_page, inode);
> - } while (error == 0);
> -
> - return error;
> + return dax_break_mapping_inode(inode, ext4_wait_dax_page);
I hit this in my compile testing:
fs/ext4/inode.c: In function ‘ext4_break_layouts’:
fs/ext4/inode.c:3915:13: error: unused variable ‘error’ [-Werror=unused-variable]
3915 | int error;
| ^~~~~
fs/ext4/inode.c:3914:22: error: unused variable ‘page’ [-Werror=unused-variable]
3914 | struct page *page;
| ^~~~
cc1: all warnings being treated as errors
...which gets fixed up later on, but bisect breakage is unwanted.
The bots will probably find this too eventually.