aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 11:38:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 11:38:30 -0500
commitc397f8fa4379040bada53256c848e62c8b060392 (patch)
tree8101efb5c0c3b0a73e5e65f3474843c0914cc4d0 /fs/ext2/inode.c
parent796e1c55717e9a6ff5c81b12289ffa1ffd919b6f (diff)
parentaaaf5fbf56f16c81a653713cc333b18ad6e25ea9 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge fifth set of updates from Andrew Morton: - A few things which were awaiting merges from linux-next: - rtc - ocfs2 - misc others - Willy's "dax" feature: direct fs access to memory (mainly NV-DIMMs) which isn't backed by pageframes. * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (37 commits) rtc: add driver for DS1685 family of real time clocks MAINTAINERS: add entry for Maxim PMICs on Samsung boards lib/Kconfig: use bool instead of boolean powerpc: drop _PAGE_FILE and pte_file()-related helpers ocfs2: set append dio as a ro compat feature ocfs2: wait for orphan recovery first once append O_DIRECT write crash ocfs2: complete the rest request through buffer io ocfs2: do not fallback to buffer I/O write if appending ocfs2: allocate blocks in ocfs2_direct_IO_get_blocks ocfs2: implement ocfs2_direct_IO_write ocfs2: add orphan recovery types in ocfs2_recover_orphans ocfs2: add functions to add and remove inode in orphan dir ocfs2: prepare some interfaces used in append direct io MAINTAINERS: fix spelling mistake & remove trailing WS dax: does not work correctly with virtual aliasing caches brd: rename XIP to DAX ext4: add DAX functionality dax: add dax_zero_page_range ext2: get rid of most mentions of XIP in ext2 ext2: remove ext2_aops_xip ...
Diffstat (limited to 'fs/ext2/inode.c')
-rw-r--r--fs/ext2/inode.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 36d35c36311d..6434bc000125 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -34,7 +34,6 @@
34#include <linux/aio.h> 34#include <linux/aio.h>
35#include "ext2.h" 35#include "ext2.h"
36#include "acl.h" 36#include "acl.h"
37#include "xip.h"
38#include "xattr.h" 37#include "xattr.h"
39 38
40static int __ext2_write_inode(struct inode *inode, int do_sync); 39static int __ext2_write_inode(struct inode *inode, int do_sync);
@@ -731,12 +730,14 @@ static int ext2_get_blocks(struct inode *inode,
731 goto cleanup; 730 goto cleanup;
732 } 731 }
733 732
734 if (ext2_use_xip(inode->i_sb)) { 733 if (IS_DAX(inode)) {
735 /* 734 /*
736 * we need to clear the block 735 * block must be initialised before we put it in the tree
736 * so that it's not found by another thread before it's
737 * initialised
737 */ 738 */
738 err = ext2_clear_xip_target (inode, 739 err = dax_clear_blocks(inode, le32_to_cpu(chain[depth-1].key),
739 le32_to_cpu(chain[depth-1].key)); 740 1 << inode->i_blkbits);
740 if (err) { 741 if (err) {
741 mutex_unlock(&ei->truncate_mutex); 742 mutex_unlock(&ei->truncate_mutex);
742 goto cleanup; 743 goto cleanup;
@@ -859,7 +860,12 @@ ext2_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
859 size_t count = iov_iter_count(iter); 860 size_t count = iov_iter_count(iter);
860 ssize_t ret; 861 ssize_t ret;
861 862
862 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, ext2_get_block); 863 if (IS_DAX(inode))
864 ret = dax_do_io(rw, iocb, inode, iter, offset, ext2_get_block,
865 NULL, DIO_LOCKING);
866 else
867 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset,
868 ext2_get_block);
863 if (ret < 0 && (rw & WRITE)) 869 if (ret < 0 && (rw & WRITE))
864 ext2_write_failed(mapping, offset + count); 870 ext2_write_failed(mapping, offset + count);
865 return ret; 871 return ret;
@@ -885,11 +891,6 @@ const struct address_space_operations ext2_aops = {
885 .error_remove_page = generic_error_remove_page, 891 .error_remove_page = generic_error_remove_page,
886}; 892};
887 893
888const struct address_space_operations ext2_aops_xip = {
889 .bmap = ext2_bmap,
890 .get_xip_mem = ext2_get_xip_mem,
891};
892
893const struct address_space_operations ext2_nobh_aops = { 894const struct address_space_operations ext2_nobh_aops = {
894 .readpage = ext2_readpage, 895 .readpage = ext2_readpage,
895 .readpages = ext2_readpages, 896 .readpages = ext2_readpages,
@@ -1201,8 +1202,8 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
1201 1202
1202 inode_dio_wait(inode); 1203 inode_dio_wait(inode);
1203 1204
1204 if (mapping_is_xip(inode->i_mapping)) 1205 if (IS_DAX(inode))
1205 error = xip_truncate_page(inode->i_mapping, newsize); 1206 error = dax_truncate_page(inode, newsize, ext2_get_block);
1206 else if (test_opt(inode->i_sb, NOBH)) 1207 else if (test_opt(inode->i_sb, NOBH))
1207 error = nobh_truncate_page(inode->i_mapping, 1208 error = nobh_truncate_page(inode->i_mapping,
1208 newsize, ext2_get_block); 1209 newsize, ext2_get_block);
@@ -1273,7 +1274,8 @@ void ext2_set_inode_flags(struct inode *inode)
1273{ 1274{
1274 unsigned int flags = EXT2_I(inode)->i_flags; 1275 unsigned int flags = EXT2_I(inode)->i_flags;
1275 1276
1276 inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); 1277 inode->i_flags &= ~(S_SYNC | S_APPEND | S_IMMUTABLE | S_NOATIME |
1278 S_DIRSYNC | S_DAX);
1277 if (flags & EXT2_SYNC_FL) 1279 if (flags & EXT2_SYNC_FL)
1278 inode->i_flags |= S_SYNC; 1280 inode->i_flags |= S_SYNC;
1279 if (flags & EXT2_APPEND_FL) 1281 if (flags & EXT2_APPEND_FL)
@@ -1284,6 +1286,8 @@ void ext2_set_inode_flags(struct inode *inode)
1284 inode->i_flags |= S_NOATIME; 1286 inode->i_flags |= S_NOATIME;
1285 if (flags & EXT2_DIRSYNC_FL) 1287 if (flags & EXT2_DIRSYNC_FL)
1286 inode->i_flags |= S_DIRSYNC; 1288 inode->i_flags |= S_DIRSYNC;
1289 if (test_opt(inode->i_sb, DAX))
1290 inode->i_flags |= S_DAX;
1287} 1291}
1288 1292
1289/* Propagate flags from i_flags to EXT2_I(inode)->i_flags */ 1293/* Propagate flags from i_flags to EXT2_I(inode)->i_flags */
@@ -1384,9 +1388,9 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
1384 1388
1385 if (S_ISREG(inode->i_mode)) { 1389 if (S_ISREG(inode->i_mode)) {
1386 inode->i_op = &ext2_file_inode_operations; 1390 inode->i_op = &ext2_file_inode_operations;
1387 if (ext2_use_xip(inode->i_sb)) { 1391 if (test_opt(inode->i_sb, DAX)) {
1388 inode->i_mapping->a_ops = &ext2_aops_xip; 1392 inode->i_mapping->a_ops = &ext2_aops;
1389 inode->i_fop = &ext2_xip_file_operations; 1393 inode->i_fop = &ext2_dax_file_operations;
1390 } else if (test_opt(inode->i_sb, NOBH)) { 1394 } else if (test_opt(inode->i_sb, NOBH)) {
1391 inode->i_mapping->a_ops = &ext2_nobh_aops; 1395 inode->i_mapping->a_ops = &ext2_nobh_aops;
1392 inode->i_fop = &ext2_file_operations; 1396 inode->i_fop = &ext2_file_operations;