aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew.r.wilcox@intel.com>2015-02-16 18:59:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-16 20:56:03 -0500
commit4c0ccfef2e9f7418a6eb0bf07a2fc8f216365b18 (patch)
treeca1c0bebddf210eab5e5428bb0416d6bfc71495b /mm
parentf7ca90b160307d63aaedab8bd451c24a182db20f (diff)
dax,ext2: replace xip_truncate_page with dax_truncate_page
It takes a get_block parameter just like nobh_truncate_page() and block_truncate_page() Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: Boaz Harrosh <boaz@plexistor.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Dave Chinner <david@fromorbit.com> Cc: Jan Kara <jack@suse.cz> Cc: Jens Axboe <axboe@kernel.dk> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap_xip.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 59fb387b2238..8e3f99b61959 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -22,43 +22,3 @@
22#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
23#include <asm/io.h> 23#include <asm/io.h>
24 24
25/*
26 * truncate a page used for execute in place
27 * functionality is analog to block_truncate_page but does use get_xip_mem
28 * to get the page instead of page cache
29 */
30int
31xip_truncate_page(struct address_space *mapping, loff_t from)
32{
33 pgoff_t index = from >> PAGE_CACHE_SHIFT;
34 unsigned offset = from & (PAGE_CACHE_SIZE-1);
35 unsigned blocksize;
36 unsigned length;
37 void *xip_mem;
38 unsigned long xip_pfn;
39 int err;
40
41 BUG_ON(!mapping->a_ops->get_xip_mem);
42
43 blocksize = 1 << mapping->host->i_blkbits;
44 length = offset & (blocksize - 1);
45
46 /* Block boundary? Nothing to do */
47 if (!length)
48 return 0;
49
50 length = blocksize - length;
51
52 err = mapping->a_ops->get_xip_mem(mapping, index, 0,
53 &xip_mem, &xip_pfn);
54 if (unlikely(err)) {
55 if (err == -ENODATA)
56 /* Hole? No need to truncate */
57 return 0;
58 else
59 return err;
60 }
61 memset(xip_mem + offset, 0, length);
62 return 0;
63}
64EXPORT_SYMBOL_GPL(xip_truncate_page);