diff options
Diffstat (limited to 'fs/ext2/inode.c')
-rw-r--r-- | fs/ext2/inode.c | 38 |
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 | ||
40 | static int __ext2_write_inode(struct inode *inode, int do_sync); | 39 | static 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 | ||
888 | const struct address_space_operations ext2_aops_xip = { | ||
889 | .bmap = ext2_bmap, | ||
890 | .get_xip_mem = ext2_get_xip_mem, | ||
891 | }; | ||
892 | |||
893 | const struct address_space_operations ext2_nobh_aops = { | 894 | const 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; |