[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190429045359.8923-8-ira.weiny@intel.com>
Date: Sun, 28 Apr 2019 21:53:56 -0700
From: ira.weiny@...el.com
To: lsf-pc@...ts.linux-foundation.org
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Dan Williams <dan.j.williams@...el.com>,
Jan Kara <jack@...e.cz>,
Jérôme Glisse <jglisse@...hat.com>,
John Hubbard <jhubbard@...dia.com>,
Michal Hocko <mhocko@...e.com>, Ira Weiny <ira.weiny@...el.com>
Subject: [RFC PATCH 07/10] fs/dax: Create function dax_mapping_is_dax()
From: Ira Weiny <ira.weiny@...el.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
Powered by blists - more mailing lists