Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] ext4: allow the dax flag to be set and cleared on inline directories
@ 2021-04-13  3:31 Theodore Ts'o
  2021-04-13  3:34 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Theodore Ts'o @ 2021-04-13  3:31 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o, stable

This is needed to allow generic/620 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: stable@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fs/ext4/ialloc.c | 3 ++-
 fs/ext4/ioctl.c  | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 5f0c7fe32672..71d321b3b984 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -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);
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index a2cf35066f46..0796bfa72829 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -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,
-- 
2.31.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: allow the dax flag to be set and cleared on inline directories
  2021-04-13  3:31 [PATCH] ext4: allow the dax flag to be set and cleared on inline directories Theodore Ts'o
@ 2021-04-13  3:34 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2021-04-13  3:34 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: stable

On Mon, Apr 12, 2021 at 11:31:24PM -0400, Theodore Ts'o wrote:
> This is needed to allow generic/620 to pass for file systems with the

"generic/620" was a typo --- it should have been "generic/607"

> 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.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13  3:31 [PATCH] ext4: allow the dax flag to be set and cleared on inline directories Theodore Ts'o
2021-04-13  3:34 ` Theodore Ts'o

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \
		linux-ext4@vger.kernel.org
	public-inbox-index linux-ext4

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-ext4


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git