2018-06-20 22:15:02

by Ross Zwisler

[permalink] [raw]
Subject: [PATCH 1/2] dax: dax_layout_busy_page() warn on !exceptional

Inodes using DAX should only ever have exceptional entries in their page
caches. Make this clear by warning if the iteration in
dax_layout_busy_page() ever sees a non-exceptional entry, and by adding a
comment for the pagevec_release() call which only deals with struct page
pointers.

Signed-off-by: Ross Zwisler <ross.zwisler-VuQAYsv1563Yd54FQh9/[email protected]>
---
fs/dax.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 641192808bb6..4a5e31f8a2d4 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -566,7 +566,7 @@ struct page *dax_layout_busy_page(struct address_space *mapping)
if (index >= end)
break;

- if (!radix_tree_exceptional_entry(pvec_ent))
+ if (WARN_ON_ONCE(!radix_tree_exceptional_entry(pvec_ent)))
continue;

xa_lock_irq(&mapping->i_pages);
@@ -578,6 +578,13 @@ struct page *dax_layout_busy_page(struct address_space *mapping)
if (page)
break;
}
+
+ /*
+ * We don't expect normal struct page entries to exist in our
+ * tree, but we keep these pagevec calls so that this code is
+ * consistent with the common pattern for handling pagevecs
+ * throughout the kernel.
+ */
pagevec_remove_exceptionals(&pvec);
pagevec_release(&pvec);
index++;
--
2.14.4


2018-06-22 08:10:23

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 1/2] dax: dax_layout_busy_page() warn on !exceptional

On Wed 20-06-18 16:15:02, Ross Zwisler wrote:
> Inodes using DAX should only ever have exceptional entries in their page
> caches. Make this clear by warning if the iteration in
> dax_layout_busy_page() ever sees a non-exceptional entry, and by adding a
> comment for the pagevec_release() call which only deals with struct page
> pointers.
>
> Signed-off-by: Ross Zwisler <ross.zwisler-VuQAYsv1563Yd54FQh9/[email protected]>
> ---
> fs/dax.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index 641192808bb6..4a5e31f8a2d4 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -566,7 +566,7 @@ struct page *dax_layout_busy_page(struct address_space *mapping)
> if (index >= end)
> break;
>
> - if (!radix_tree_exceptional_entry(pvec_ent))
> + if (WARN_ON_ONCE(!radix_tree_exceptional_entry(pvec_ent)))

Please wrap this line. Otherwise the patch looks good. You can add:

Reviewed-by: Jan Kara <[email protected]>

Honza
--
Jan Kara <jack-IBi9RG/[email protected]>
SUSE Labs, CR