All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Jan Kara <jack@suse.cz>, Dan Williams <dan.j.williams@intel.com>,
	Dave Chinner <david@fromorbit.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-nvdimm@lists.01.org, Jeff Moyer <jmoyer@redhat.com>,
	linux-ext4@vger.kernel.org
Subject: [PATCH v2 1/2] dax: dax_layout_busy_page() warn on !exceptional
Date: Wed, 27 Jun 2018 15:22:51 -0600	[thread overview]
Message-ID: <20180627212252.31032-2-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <20180627212252.31032-1-ross.zwisler@linux.intel.com>

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@linux.intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 fs/dax.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 641192808bb6..897b51e41d8f 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -566,7 +566,8 @@ 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 +579,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

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	Dan Williams
	<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Dave Chinner <david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org>,
	"Darrick J. Wong"
	<darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
	Jeff Moyer <jmoyer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v2 1/2] dax: dax_layout_busy_page() warn on !exceptional
Date: Wed, 27 Jun 2018 15:22:51 -0600	[thread overview]
Message-ID: <20180627212252.31032-2-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <20180627212252.31032-1-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

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/CA@public.gmane.org>
Reviewed-by: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>
---
 fs/dax.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 641192808bb6..897b51e41d8f 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -566,7 +566,8 @@ 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 +579,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

  reply	other threads:[~2018-06-27 21:22 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27 21:22 [PATCH v2 0/2] ext4: fix DAX dma vs truncate/hole-punch Ross Zwisler
2018-06-27 21:22 ` Ross Zwisler
2018-06-27 21:22 ` Ross Zwisler [this message]
2018-06-27 21:22   ` [PATCH v2 1/2] dax: dax_layout_busy_page() warn on !exceptional Ross Zwisler
2018-07-02 22:15   ` Theodore Y. Ts'o
2018-07-02 22:15     ` Theodore Y. Ts'o
2018-07-03 15:41     ` Ross Zwisler
2018-07-03 15:41       ` Ross Zwisler
2018-07-03 17:44       ` Theodore Y. Ts'o
2018-07-03 17:44         ` Theodore Y. Ts'o
2018-06-27 21:22 ` [PATCH v2 2/2] ext4: handle layout changes to pinned DAX mappings Ross Zwisler
2018-06-27 21:22   ` Ross Zwisler
2018-06-29 12:02   ` Lukas Czerner
2018-06-29 12:02     ` Lukas Czerner
2018-06-29 15:13     ` Ross Zwisler
2018-06-29 15:13       ` Ross Zwisler
2018-07-02  7:34       ` Jan Kara
2018-07-02  7:34         ` Jan Kara
2018-07-02  7:59       ` Lukas Czerner
2018-07-02  7:59         ` Lukas Czerner
2018-07-02 16:27         ` Ross Zwisler
2018-07-02 16:27           ` Ross Zwisler
2018-06-30  1:12     ` Dave Chinner
2018-06-30  1:12       ` Dave Chinner
2018-07-02 17:29   ` [PATCH v3 " Ross Zwisler
2018-07-02 17:29     ` Ross Zwisler
2018-07-04  0:49     ` Dave Chinner
2018-07-04  0:49       ` Dave Chinner
2018-07-04 12:27       ` Jan Kara
2018-07-04 12:27         ` Jan Kara
2018-07-04 23:54         ` Dave Chinner
2018-07-04 23:54           ` Dave Chinner
2018-07-05  3:59           ` Darrick J. Wong
2018-07-05  3:59             ` Darrick J. Wong
2018-07-05 16:53             ` Ross Zwisler
2018-07-05 16:53               ` Ross Zwisler
2018-07-09 12:33               ` Jan Kara
2018-07-09 12:33                 ` Jan Kara
2018-07-09 16:23                 ` Darrick J. Wong
2018-07-09 16:23                   ` Darrick J. Wong
2018-07-09 19:49                   ` Jan Kara
2018-07-09 19:49                     ` Jan Kara
2018-07-05 20:40             ` Dan Williams
2018-07-05 20:40               ` Dan Williams
2018-07-05 23:29               ` Dave Chinner
2018-07-05 23:29                 ` Dave Chinner
2018-07-06  5:08                 ` Dan Williams
2018-07-06  5:08                   ` Dan Williams
2018-07-09  9:59                 ` Lukas Czerner
2018-07-09  9:59                   ` Lukas Czerner
2018-07-09 16:18                   ` Darrick J. Wong
2018-07-09 16:18                     ` Darrick J. Wong

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=20180627212252.31032-2-ross.zwisler@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=jmoyer@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.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 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.