summaryrefslogtreecommitdiffstats
path: root/fs/ext4/inline.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-11-20 17:32:59 -0500
committerTheodore Ts'o <tytso@mit.edu>2016-11-20 17:32:59 -0500
commita3caa24b703794507bf2e0a68bdc800b90f5e70b (patch)
treeb133b0f2c3a4e61904a2be8a97b1dd63617453fe /fs/ext4/inline.c
parent213bcd9ccbf04b709e4764ad89aaaa66a47785f0 (diff)
downloadlinux-a3caa24b703794507bf2e0a68bdc800b90f5e70b.tar.gz
linux-a3caa24b703794507bf2e0a68bdc800b90f5e70b.tar.bz2
linux-a3caa24b703794507bf2e0a68bdc800b90f5e70b.zip
ext4: only set S_DAX if DAX is really supported
Currently we have S_DAX set inode->i_flags for a regular file whenever ext4 is mounted with dax mount option. However in some cases we cannot really do DAX - e.g. when inode is marked to use data journalling, when inode data is being encrypted, or when inode is stored inline. Make sure S_DAX flag is appropriately set/cleared in these cases. Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r--fs/ext4/inline.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index cfa87bd49c5a..9b67f75bdcf7 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -299,6 +299,11 @@ static int ext4_create_inline_data(handle_t *handle,
EXT4_I(inode)->i_inline_size = len + EXT4_MIN_INLINE_DATA_SIZE;
ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS);
ext4_set_inode_flag(inode, EXT4_INODE_INLINE_DATA);
+ /*
+ * Propagate changes to inode->i_flags as well - e.g. S_DAX may
+ * get cleared
+ */
+ ext4_set_inode_flags(inode);
get_bh(is.iloc.bh);
error = ext4_mark_iloc_dirty(handle, inode, &is.iloc);
@@ -442,6 +447,11 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle,
}
}
ext4_clear_inode_flag(inode, EXT4_INODE_INLINE_DATA);
+ /*
+ * Propagate changes to inode->i_flags as well - e.g. S_DAX may
+ * get set.
+ */
+ ext4_set_inode_flags(inode);
get_bh(is.iloc.bh);
error = ext4_mark_iloc_dirty(handle, inode, &is.iloc);