Skip to content

Commit

Permalink
ext4: allow the dax flag to be set and cleared on inline directories
Browse files Browse the repository at this point in the history
This is needed to allow generic/607 to pass for file systems with the
inline data_feature enabled, and it allows the use of file systems
where the directories use inline_data, while the files are accessed
via DAX.

Cc: [email protected]
Signed-off-by: Theodore Ts'o <[email protected]>
  • Loading branch information
tytso committed Apr 13, 2021
1 parent fcdf3c3 commit 4811d99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/ext4/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,8 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,

ei->i_extra_isize = sbi->s_want_extra_isize;
ei->i_inline_off = 0;
if (ext4_has_feature_inline_data(sb))
if (ext4_has_feature_inline_data(sb) &&
(!(ei->i_flags & EXT4_DAX_FL) || S_ISDIR(mode)))
ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
ret = inode;
err = dquot_alloc_inode(inode);
Expand Down
6 changes: 6 additions & 0 deletions fs/ext4/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ static void ext4_dax_dontcache(struct inode *inode, unsigned int flags)
static bool dax_compatible(struct inode *inode, unsigned int oldflags,
unsigned int flags)
{
/* Allow the DAX flag to be changed on inline directories */
if (S_ISDIR(inode->i_mode)) {
flags &= ~EXT4_INLINE_DATA_FL;
oldflags &= ~EXT4_INLINE_DATA_FL;
}

if (flags & EXT4_DAX_FL) {
if ((oldflags & EXT4_DAX_MUT_EXCL) ||
ext4_test_inode_state(inode,
Expand Down

0 comments on commit 4811d99

Please sign in to comment.