[Devel] [PATCH RHEL7 COMMIT] fs: Export mapping_needs_writeback()

Vasily Averin vvs at virtuozzo.com
Fri Aug 7 09:01:40 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.1
------>
commit 67aa5906009e1c3b1f5da7bdbf12f36073eb46d3
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Aug 7 09:01:40 2020 +0300

    fs: Export mapping_needs_writeback()
    
    Patchset descritpyion:
    ploop: Protect fastmap against defrag and punch hole
    https://jira.sw.ru/browse/PSBM-105347
    
    This protects fastmap against mapped extent disappearance,
    which may be a result of extenal actions (move extent and
    punch hole) on root.hds. Thus, root.hds becomes more "normal"
    file.
    
    Kirill Tkhai (4):
          ploop: Introduce ->fastmap_end_io
          ploop: Add @write argument to ->fastmap
          fs: Export mapping_needs_writeback()
          ploop: io_kaio: Protect ->fastmap against EXT4_IOC_MOVE_EXT and punch hole
    
    Current patch description:
    [PATCH 3/4] fs: Export mapping_needs_writeback()
    
    For next patch.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 include/linux/pagemap.h | 7 +++++++
 mm/filemap.c            | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 830eb58..22c74401 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -14,6 +14,7 @@
 #include <linux/bitops.h>
 #include <linux/hardirq.h> /* for in_interrupt() */
 #include <linux/hugetlb_inline.h>
+#include <linux/dax.h>
 
 /*
  * Bits in mapping->flags.  The lower __GFP_BITS_SHIFT bits are the page
@@ -117,6 +118,12 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
 				(__force unsigned long)mask;
 }
 
+static inline bool mapping_needs_writeback(struct address_space *mapping)
+{
+	return (!dax_mapping(mapping) && mapping->nrpages) ||
+	    (dax_mapping(mapping) && mapping->nrexceptional);
+}
+
 /*
  * The page cache can done in larger chunks than
  * one page, because it allows for more efficient
diff --git a/mm/filemap.c b/mm/filemap.c
index 0346d60..53db13f 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -499,12 +499,6 @@ int filemap_fdatawait_keep_errors(struct address_space *mapping)
 }
 EXPORT_SYMBOL(filemap_fdatawait_keep_errors);
 
-static bool mapping_needs_writeback(struct address_space *mapping)
-{
-	return (!dax_mapping(mapping) && mapping->nrpages) ||
-	    (dax_mapping(mapping) && mapping->nrexceptional);
-}
-
 int filemap_write_and_wait(struct address_space *mapping)
 {
 	int err = 0;


More information about the Devel mailing list