From: Jan Kara <jack@suse.cz>
To: Alistair Popple <apopple@nvidia.com>
Cc: linux-mm@kvack.org, david@fromorbit.com,
dan.j.williams@intel.com, jhubbard@nvidia.com,
rcampbell@nvidia.com, willy@infradead.org, jgg@nvidia.com,
linux-fsdevel@vger.kernel.org, jack@suse.cz, djwong@kernel.org,
hch@lst.de, david@redhat.com, ruansy.fnst@fujitsu.com,
nvdimm@lists.linux.dev, linux-xfs@vger.kernel.org,
linux-ext4@vger.kernel.org, jglisse@redhat.com
Subject: Re: [RFC 05/10] fs/dax: Refactor wait for dax idle page
Date: Fri, 12 Apr 2024 16:37:49 +0200 [thread overview]
Message-ID: <20240412143749.3tryph4khox3euef@quack3> (raw)
In-Reply-To: <db13f495fc0addcff12b6b065b7a6b25f09c4be7.1712796818.git-series.apopple@nvidia.com>
On Thu 11-04-24 10:57:26, Alistair Popple wrote:
> A FS DAX page is considered idle when its refcount drops to one. This
> is currently open-coded in all file systems supporting FS DAX. Move
> the idle detection to a common function to make future changes easier.
>
> Signed-off-by: Alistair Popple <apopple@nvidia.com>
Good cleanup. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/inode.c | 5 +----
> fs/fuse/dax.c | 4 +---
> fs/xfs/xfs_file.c | 4 +---
> include/linux/dax.h | 11 +++++++++++
> 4 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 4ce35f1..e9cef7d 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3868,10 +3868,7 @@ int ext4_break_layouts(struct inode *inode)
> if (!page)
> return 0;
>
> - error = ___wait_var_event(&page->_refcount,
> - atomic_read(&page->_refcount) == 1,
> - TASK_INTERRUPTIBLE, 0, 0,
> - ext4_wait_dax_page(inode));
> + error = dax_wait_page_idle(page, ext4_wait_dax_page, inode);
> } while (error == 0);
>
> return error;
> diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
> index 23904a6..8a62483 100644
> --- a/fs/fuse/dax.c
> +++ b/fs/fuse/dax.c
> @@ -676,9 +676,7 @@ static int __fuse_dax_break_layouts(struct inode *inode, bool *retry,
> return 0;
>
> *retry = true;
> - return ___wait_var_event(&page->_refcount,
> - atomic_read(&page->_refcount) == 1, TASK_INTERRUPTIBLE,
> - 0, 0, fuse_wait_dax_page(inode));
> + return dax_wait_page_idle(page, fuse_wait_dax_page, inode);
> }
>
> /* dmap_end == 0 leads to unmapping of whole file */
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 2037002..099cd70 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -849,9 +849,7 @@ xfs_break_dax_layouts(
> return 0;
>
> *retry = true;
> - return ___wait_var_event(&page->_refcount,
> - atomic_read(&page->_refcount) == 1, TASK_INTERRUPTIBLE,
> - 0, 0, xfs_wait_dax_page(inode));
> + return dax_wait_page_idle(page, xfs_wait_dax_page, inode);
> }
>
> int
> diff --git a/include/linux/dax.h b/include/linux/dax.h
> index 22cd990..bced4d4 100644
> --- a/include/linux/dax.h
> +++ b/include/linux/dax.h
> @@ -212,6 +212,17 @@ int dax_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero,
> int dax_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
> const struct iomap_ops *ops);
>
> +static inline int dax_wait_page_idle(struct page *page,
> + void (cb)(struct inode *),
> + struct inode *inode)
> +{
> + int ret;
> +
> + ret = ___wait_var_event(page, page_ref_count(page) == 1,
> + TASK_INTERRUPTIBLE, 0, 0, cb(inode));
> + return ret;
> +}
> +
> #if IS_ENABLED(CONFIG_DAX)
> int dax_read_lock(void);
> void dax_read_unlock(int id);
> --
> git-series 0.9.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-04-12 14:38 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 0:57 [RFC 00/10] fs/dax: Fix FS DAX page reference counts Alistair Popple
2024-04-11 0:57 ` [RFC 01/10] mm/gup.c: Remove redundant check for PCI P2PDMA page Alistair Popple
2024-04-11 12:59 ` Jason Gunthorpe
2024-04-11 13:47 ` David Hildenbrand
2024-04-12 1:37 ` Alistair Popple
2024-04-11 0:57 ` [RFC 02/10] mm/hmm: Remove dead check for HugeTLB and FS DAX Alistair Popple
2024-04-11 12:25 ` Jason Gunthorpe
2024-04-11 13:37 ` Peter Xu
2024-04-12 1:28 ` Alistair Popple
2024-04-11 0:57 ` [RFC 03/10] pci/p2pdma: Don't initialise page refcount to one Alistair Popple
2024-04-11 12:29 ` Jason Gunthorpe
2024-04-12 5:40 ` Alistair Popple
2024-04-12 17:20 ` Dan Williams
2024-05-09 21:59 ` Logan Gunthorpe
2024-05-09 23:14 ` Alistair Popple
2024-04-11 0:57 ` [RFC 04/10] fs/dax: Don't track page mapping/index Alistair Popple
2024-04-12 15:22 ` Jan Kara
2024-04-12 17:31 ` Dan Williams
2024-04-15 7:03 ` Alistair Popple
2024-04-15 20:51 ` Dan Williams
2024-04-16 0:07 ` Alistair Popple
2024-04-16 0:36 ` Dan Williams
2024-04-12 17:21 ` Dan Williams
2024-04-11 0:57 ` [RFC 05/10] fs/dax: Refactor wait for dax idle page Alistair Popple
2024-04-12 14:37 ` Jan Kara [this message]
2024-04-13 20:19 ` John Hubbard
2024-04-15 8:41 ` Alistair Popple
2024-04-11 0:57 ` [RFC 06/10] fs/dax: Add dax_page_free callback Alistair Popple
2024-04-11 0:57 ` [RFC 07/10] mm: Allow compound zone device pages Alistair Popple
2024-04-11 12:32 ` Jason Gunthorpe
2024-04-11 14:10 ` Matthew Wilcox
2024-04-12 1:38 ` Alistair Popple
2024-04-11 0:57 ` [RFC 08/10] fs/dax: Properly refcount fs dax pages Alistair Popple
2024-04-11 0:57 ` [RFC 09/10] mm/khugepage.c: Warn if trying to scan devmap pmd Alistair Popple
2024-04-11 13:45 ` David Hildenbrand
2024-04-12 1:34 ` Alistair Popple
2024-04-11 0:57 ` [RFC 10/10] mm: Remove pXX_devmap Alistair Popple
2024-04-11 12:57 ` Jason Gunthorpe
2024-04-11 17:28 ` [RFC 00/10] fs/dax: Fix FS DAX page reference counts Dan Williams
2024-04-11 17:35 ` Jason Gunthorpe
2024-04-11 17:56 ` Dan Williams
2024-04-12 3:54 ` Alistair Popple
2024-04-12 6:55 ` Alistair Popple
2024-04-12 11:53 ` Jason Gunthorpe
2024-04-12 17:32 ` Dan Williams
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=20240412143749.3tryph4khox3euef@quack3 \
--to=jack@suse.cz \
--cc=apopple@nvidia.com \
--cc=dan.j.williams@intel.com \
--cc=david@fromorbit.com \
--cc=david@redhat.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=jgg@nvidia.com \
--cc=jglisse@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=rcampbell@nvidia.com \
--cc=ruansy.fnst@fujitsu.com \
--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;
as well as URLs for NNTP newsgroup(s).