Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
[sfrench/cifs-2.6.git] / fs / ext2 / inode.c
index 01f6d4be7f9aae0bb0a39899e2ab003da6045974..0093ea2512a85809e16605088074a8335513e81c 100644 (file)
@@ -732,16 +732,13 @@ static int ext2_get_blocks(struct inode *inode,
        }
 
        if (IS_DAX(inode)) {
-               int i;
-
                /*
                 * We must unmap blocks before zeroing so that writeback cannot
                 * overwrite zeros with stale data from block device page cache.
                 */
-               for (i = 0; i < count; i++) {
-                       unmap_underlying_metadata(inode->i_sb->s_bdev,
-                                       le32_to_cpu(chain[depth-1].key) + i);
-               }
+               clean_bdev_aliases(inode->i_sb->s_bdev,
+                                  le32_to_cpu(chain[depth-1].key),
+                                  count);
                /*
                 * block must be initialised before we put it in the tree
                 * so that it's not found by another thread before it's
@@ -850,6 +847,9 @@ struct iomap_ops ext2_iomap_ops = {
        .iomap_begin            = ext2_iomap_begin,
        .iomap_end              = ext2_iomap_end,
 };
+#else
+/* Define empty ops for !CONFIG_FS_DAX case to avoid ugly ifdefs */
+struct iomap_ops ext2_iomap_ops;
 #endif /* CONFIG_FS_DAX */
 
 int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
@@ -1293,9 +1293,11 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
 
        inode_dio_wait(inode);
 
-       if (IS_DAX(inode))
-               error = dax_truncate_page(inode, newsize, ext2_get_block);
-       else if (test_opt(inode->i_sb, NOBH))
+       if (IS_DAX(inode)) {
+               error = iomap_zero_range(inode, newsize,
+                                        PAGE_ALIGN(newsize) - newsize, NULL,
+                                        &ext2_iomap_ops);
+       } else if (test_opt(inode->i_sb, NOBH))
                error = nobh_truncate_page(inode->i_mapping,
                                newsize, ext2_get_block);
        else