add patch improve-code-readability-in-ext4_iget
[ext4-patch-queue.git] / dax_layout_busy_warn_on_not_exceptional
blobb353c6e2d4f7b74228844b7d236055dc1baa0854
1 dax: dax_layout_busy_page() warn on !exceptional
3 From: Ross Zwisler <ross.zwisler@linux.intel.com>
5 Inodes using DAX should only ever have exceptional entries in their page
6 caches.  Make this clear by warning if the iteration in
7 dax_layout_busy_page() ever sees a non-exceptional entry, and by adding a
8 comment for the pagevec_release() call which only deals with struct page
9 pointers.
11 Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
12 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 Reviewed-by: Jan Kara <jack@suse.cz>
14 ---
15  fs/dax.c | 10 +++++++++-
16  1 file changed, 9 insertions(+), 1 deletion(-)
18 diff --git a/fs/dax.c b/fs/dax.c
19 index 641192808bb6..897b51e41d8f 100644
20 --- a/fs/dax.c
21 +++ b/fs/dax.c
22 @@ -566,7 +566,8 @@ struct page *dax_layout_busy_page(struct address_space *mapping)
23                         if (index >= end)
24                                 break;
26 -                       if (!radix_tree_exceptional_entry(pvec_ent))
27 +                       if (WARN_ON_ONCE(
28 +                            !radix_tree_exceptional_entry(pvec_ent)))
29                                 continue;
31                         xa_lock_irq(&mapping->i_pages);
32 @@ -578,6 +579,13 @@ struct page *dax_layout_busy_page(struct address_space *mapping)
33                         if (page)
34                                 break;
35                 }
37 +               /*
38 +                * We don't expect normal struct page entries to exist in our
39 +                * tree, but we keep these pagevec calls so that this code is
40 +                * consistent with the common pattern for handling pagevecs
41 +                * throughout the kernel.
42 +                */
43                 pagevec_remove_exceptionals(&pvec);
44                 pagevec_release(&pvec);
45                 index++;
46 -- 
47 2.14.4