From: ira.weiny@intel.com
To: lsf-pc@lists.linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, "Dan Williams" <dan.j.williams@intel.com>,
"Jan Kara" <jack@suse.cz>, "Jérôme Glisse" <jglisse@redhat.com>,
"John Hubbard" <jhubbard@nvidia.com>,
"Michal Hocko" <mhocko@suse.com>,
"Ira Weiny" <ira.weiny@intel.com>
Subject: [RFC PATCH 07/10] fs/dax: Create function dax_mapping_is_dax()
Date: Sun, 28 Apr 2019 21:53:56 -0700 [thread overview]
Message-ID: <20190429045359.8923-8-ira.weiny@intel.com> (raw)
In-Reply-To: <20190429045359.8923-1-ira.weiny@intel.com>
From: Ira Weiny <ira.weiny@intel.com>
In order to support longterm lease breaking operations. Lease break
code in the file systems need to know if a mapping is DAX.
Split out the logic to determine if a mapping is DAX and export it.
---
fs/dax.c | 23 ++++++++++++++++-------
include/linux/dax.h | 6 ++++++
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/fs/dax.c b/fs/dax.c
index ca0671d55aa6..c3a932235e88 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -551,6 +551,21 @@ static void *grab_mapping_entry(struct xa_state *xas,
return xa_mk_internal(VM_FAULT_FALLBACK);
}
+bool dax_mapping_is_dax(struct address_space *mapping)
+{
+ /*
+ * In the 'limited' case get_user_pages() for dax is disabled.
+ */
+ if (IS_ENABLED(CONFIG_FS_DAX_LIMITED))
+ return false;
+
+ if (!dax_mapping(mapping) || !mapping_mapped(mapping))
+ return false;
+
+ return true;
+}
+EXPORT_SYMBOL_GPL(dax_mapping_is_dax);
+
/**
* dax_layout_busy_page - find first pinned page in @mapping
* @mapping: address space to scan for a page with ref count > 1
@@ -573,13 +588,7 @@ struct page *dax_layout_busy_page(struct address_space *mapping)
unsigned int scanned = 0;
struct page *page = NULL;
- /*
- * In the 'limited' case get_user_pages() for dax is disabled.
- */
- if (IS_ENABLED(CONFIG_FS_DAX_LIMITED))
- return NULL;
-
- if (!dax_mapping(mapping) || !mapping_mapped(mapping))
+ if (!dax_mapping_is_dax(mapping))
return NULL;
/*
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 0dd316a74a29..78fea21b990e 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -89,6 +89,7 @@ struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev);
int dax_writeback_mapping_range(struct address_space *mapping,
struct block_device *bdev, struct writeback_control *wbc);
+bool dax_mapping_is_dax(struct address_space *mapping);
struct page *dax_layout_busy_page(struct address_space *mapping);
dax_entry_t dax_lock_page(struct page *page);
void dax_unlock_page(struct page *page, dax_entry_t cookie);
@@ -113,6 +114,11 @@ static inline struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)
return NULL;
}
+bool dax_mapping_is_dax(struct address_space *mapping)
+{
+ return false;
+}
+
static inline struct page *dax_layout_busy_page(struct address_space *mapping)
{
return NULL;
--
2.20.1
next prev parent reply other threads:[~2019-04-29 4:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-29 4:53 [RFC PATCH 00/10] RDMA/FS DAX "LONGTERM" lease proposal ira.weiny
2019-04-29 4:53 ` [RFC PATCH 01/10] fs/locks: Add trace_leases_conflict ira.weiny
2019-04-29 4:53 ` [RFC PATCH 02/10] fs/locks: Introduce FL_LONGTERM file lease ira.weiny
2019-04-29 4:53 ` [RFC PATCH 03/10] mm/gup: Pass flags down to __gup_device_huge* calls ira.weiny
2019-04-29 4:53 ` [RFC PATCH 04/10] WIP: mm/gup: Ensure F_LONGTERM lease is held on GUP pages ira.weiny
2019-04-29 4:53 ` [RFC PATCH 05/10] mm/gup: Take FL_LONGTERM lease if not set by user ira.weiny
2019-04-29 4:53 ` [RFC PATCH 06/10] fs/locks: Add longterm lease traces ira.weiny
2019-04-29 4:53 ` ira.weiny [this message]
2019-04-29 4:53 ` [RFC PATCH 08/10] mm/gup: fs: Send SIGBUS on truncate of active file ira.weiny
2019-04-29 4:53 ` [RFC PATCH 09/10] fs/locks: Add tracepoint for SIGBUS on LONGTERM expiration ira.weiny
2019-04-29 4:53 ` [RFC PATCH 10/10] mm/gup: Remove FOLL_LONGTERM DAX exclusion ira.weiny
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=20190429045359.8923-8-ira.weiny@intel.com \
--to=ira.weiny@intel.com \
--cc=dan.j.williams@intel.com \
--cc=jack@suse.cz \
--cc=jglisse@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lsf-pc@lists.linux-foundation.org \
--cc=mhocko@suse.com \
/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).