aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-08-31 11:56:51 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-08-31 11:56:51 -0400
commit84ebd795613488992b273220c2937d575d27d2a9 (patch)
tree102201c078c73d911f0a1eb656ee057fe2806489 /fs/ext4/inode.c
parent1cd9f0976aa4606db8d6e3dc3edd0aca8019372a (diff)
ext4: fake direct I/O mode for data=journal
Currently attempts to open a file with O_DIRECT in data=journal mode causes the open to fail with -EINVAL. This makes it very hard to test data=journal mode. So we will let the open succeed, but then always fall back to O_DSYNC buffered writes. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 18d2558b7624..b84f127c085d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2854,6 +2854,12 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
2854 struct inode *inode = file->f_mapping->host; 2854 struct inode *inode = file->f_mapping->host;
2855 ssize_t ret; 2855 ssize_t ret;
2856 2856
2857 /*
2858 * If we are doing data journalling we don't support O_DIRECT
2859 */
2860 if (ext4_should_journal_data(inode))
2861 return 0;
2862
2857 trace_ext4_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw); 2863 trace_ext4_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw);
2858 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) 2864 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
2859 ret = ext4_ext_direct_IO(rw, iocb, iov, offset, nr_segs); 2865 ret = ext4_ext_direct_IO(rw, iocb, iov, offset, nr_segs);
@@ -2923,6 +2929,7 @@ static const struct address_space_operations ext4_journalled_aops = {
2923 .bmap = ext4_bmap, 2929 .bmap = ext4_bmap,
2924 .invalidatepage = ext4_invalidatepage, 2930 .invalidatepage = ext4_invalidatepage,
2925 .releasepage = ext4_releasepage, 2931 .releasepage = ext4_releasepage,
2932 .direct_IO = ext4_direct_IO,
2926 .is_partially_uptodate = block_is_partially_uptodate, 2933 .is_partially_uptodate = block_is_partially_uptodate,
2927 .error_remove_page = generic_error_remove_page, 2934 .error_remove_page = generic_error_remove_page,
2928}; 2935};