diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2015-02-16 18:58:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-16 20:56:03 -0500 |
commit | fbbbad4bc2101e452b24e6e65d3d5e11314a0b5f (patch) | |
tree | 7d12515701e867b88856b0c7f78c9abd7a61785b /fs/ext2 | |
parent | 2e4cdab0584fa884e0a81c4f45b93ce875c9fcaa (diff) |
vfs,ext2: introduce IS_DAX(inode)
Use an inode flag to tag inodes which should avoid using the page cache.
Convert ext2 to use it instead of mapping_is_xip(). Prevent I/Os to files
tagged with the DAX flag from falling back to buffered I/O.
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
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: 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 'fs/ext2')
-rw-r--r-- | fs/ext2/inode.c | 9 | ||||
-rw-r--r-- | fs/ext2/xip.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 36d35c36311d..0cb04486577d 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -731,7 +731,7 @@ static int ext2_get_blocks(struct inode *inode, | |||
731 | goto cleanup; | 731 | goto cleanup; |
732 | } | 732 | } |
733 | 733 | ||
734 | if (ext2_use_xip(inode->i_sb)) { | 734 | if (IS_DAX(inode)) { |
735 | /* | 735 | /* |
736 | * we need to clear the block | 736 | * we need to clear the block |
737 | */ | 737 | */ |
@@ -1201,7 +1201,7 @@ static int ext2_setsize(struct inode *inode, loff_t newsize) | |||
1201 | 1201 | ||
1202 | inode_dio_wait(inode); | 1202 | inode_dio_wait(inode); |
1203 | 1203 | ||
1204 | if (mapping_is_xip(inode->i_mapping)) | 1204 | if (IS_DAX(inode)) |
1205 | error = xip_truncate_page(inode->i_mapping, newsize); | 1205 | error = xip_truncate_page(inode->i_mapping, newsize); |
1206 | else if (test_opt(inode->i_sb, NOBH)) | 1206 | else if (test_opt(inode->i_sb, NOBH)) |
1207 | error = nobh_truncate_page(inode->i_mapping, | 1207 | error = nobh_truncate_page(inode->i_mapping, |
@@ -1273,7 +1273,8 @@ void ext2_set_inode_flags(struct inode *inode) | |||
1273 | { | 1273 | { |
1274 | unsigned int flags = EXT2_I(inode)->i_flags; | 1274 | unsigned int flags = EXT2_I(inode)->i_flags; |
1275 | 1275 | ||
1276 | inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); | 1276 | inode->i_flags &= ~(S_SYNC | S_APPEND | S_IMMUTABLE | S_NOATIME | |
1277 | S_DIRSYNC | S_DAX); | ||
1277 | if (flags & EXT2_SYNC_FL) | 1278 | if (flags & EXT2_SYNC_FL) |
1278 | inode->i_flags |= S_SYNC; | 1279 | inode->i_flags |= S_SYNC; |
1279 | if (flags & EXT2_APPEND_FL) | 1280 | if (flags & EXT2_APPEND_FL) |
@@ -1284,6 +1285,8 @@ void ext2_set_inode_flags(struct inode *inode) | |||
1284 | inode->i_flags |= S_NOATIME; | 1285 | inode->i_flags |= S_NOATIME; |
1285 | if (flags & EXT2_DIRSYNC_FL) | 1286 | if (flags & EXT2_DIRSYNC_FL) |
1286 | inode->i_flags |= S_DIRSYNC; | 1287 | inode->i_flags |= S_DIRSYNC; |
1288 | if (test_opt(inode->i_sb, XIP)) | ||
1289 | inode->i_flags |= S_DAX; | ||
1287 | } | 1290 | } |
1288 | 1291 | ||
1289 | /* Propagate flags from i_flags to EXT2_I(inode)->i_flags */ | 1292 | /* Propagate flags from i_flags to EXT2_I(inode)->i_flags */ |
diff --git a/fs/ext2/xip.h b/fs/ext2/xip.h index 18b34d2f31b3..29be73781419 100644 --- a/fs/ext2/xip.h +++ b/fs/ext2/xip.h | |||
@@ -16,9 +16,7 @@ static inline int ext2_use_xip (struct super_block *sb) | |||
16 | } | 16 | } |
17 | int ext2_get_xip_mem(struct address_space *, pgoff_t, int, | 17 | int ext2_get_xip_mem(struct address_space *, pgoff_t, int, |
18 | void **, unsigned long *); | 18 | void **, unsigned long *); |
19 | #define mapping_is_xip(map) unlikely(map->a_ops->get_xip_mem) | ||
20 | #else | 19 | #else |
21 | #define mapping_is_xip(map) 0 | ||
22 | #define ext2_xip_verify_sb(sb) do { } while (0) | 20 | #define ext2_xip_verify_sb(sb) do { } while (0) |
23 | #define ext2_use_xip(sb) 0 | 21 | #define ext2_use_xip(sb) 0 |
24 | #define ext2_clear_xip_target(inode, chain) 0 | 22 | #define ext2_clear_xip_target(inode, chain) 0 |