2024-02-05 10:17:17

by Ojaswin Mujoo

[permalink] [raw]
Subject: Running out of inode flags in ext4

Hi folks,

I'm trying to rework the ext4 atomic write patchset so we have similar
semantics as discussed here [1], which would look something like:

1. we call FS_IOC_FSSETXATTR to enable atomic write on inode

2. In the setxattr path, we need to mark the inode with
atomic_write_enabled. XFS does it via an on disk inode flag which is
straightforward enough

However, on ext4 we are almost out of 32 bits of inode flags and I don't
think it's possible to add any flags2 field or something (iiuc, ondisk
indoe doesn't have scope for expansion).

Some ideas that I have:

- I see that 0x00400000 (formerly EXT4_EOFBLOCKS_FL) is free to use but
as per my understanding, this is interpreted in some way by older fsck
versions. However, marking atomic writes as RO_COMPAT might help aavoid
confusion in fsck.

- If we can't use inode flags, should we maybe use xattr to store
atomic_write details?

Should I go with either of above or is there a better way to mark
ext4 inodes which I might be missing. Also, now that we are out of inode
flags, what's the recommended way to handle such use cases in the
future?

Would appreciate some suggestions on this.

Thanks,
ojaswin

[1]
https://lore.kernel.org/all/[email protected]/