Skip to content

Commit 4811d99

Browse files
committed
ext4: allow the dax flag to be set and cleared on inline directories
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]>
1 parent fcdf3c3 commit 4811d99

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

fs/ext4/ialloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,8 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,
12921292

12931293
ei->i_extra_isize = sbi->s_want_extra_isize;
12941294
ei->i_inline_off = 0;
1295-
if (ext4_has_feature_inline_data(sb))
1295+
if (ext4_has_feature_inline_data(sb) &&
1296+
(!(ei->i_flags & EXT4_DAX_FL) || S_ISDIR(mode)))
12961297
ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
12971298
ret = inode;
12981299
err = dquot_alloc_inode(inode);

fs/ext4/ioctl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,12 @@ static void ext4_dax_dontcache(struct inode *inode, unsigned int flags)
315315
static bool dax_compatible(struct inode *inode, unsigned int oldflags,
316316
unsigned int flags)
317317
{
318+
/* Allow the DAX flag to be changed on inline directories */
319+
if (S_ISDIR(inode->i_mode)) {
320+
flags &= ~EXT4_INLINE_DATA_FL;
321+
oldflags &= ~EXT4_INLINE_DATA_FL;
322+
}
323+
318324
if (flags & EXT4_DAX_FL) {
319325
if ((oldflags & EXT4_DAX_MUT_EXCL) ||
320326
ext4_test_inode_state(inode,

0 commit comments

Comments
 (0)