---- 在 星期四, 2020-10-15 00:15:38 Jan Kara <jack@xxxxxxx> 撰写 ---- > On Sat 10-10-20 22:23:51, Chengguang Xu wrote: > > Currently there is no notification api for kernel about modification > > of vfs inode, in some use cases like overlayfs, this kind of notification > > will be very helpful to implement containerized syncfs functionality. > > As the first attempt, we introduce marking inode dirty notification so that > > overlay's inode could mark itself dirty as well and then only sync dirty > > overlay inode while syncfs. > > > > Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxxxx> > > So I like how the patch set is elegant however growing struct inode for > everybody by struct blocking_notifier_head (which is rwsem + pointer) is > rather harsh just for this overlayfs functionality... Ideally this should > induce no overhead on struct inode if the filesystem is not covered by > overlayfs. So I'd rather place some external structure into the superblock > that would get allocated on the first use that would track dirty notifications > for each inode. I would not generalize the code for more possible > notifications at this point. > > Also now that I'm thinking about it can there be multiple overlayfs inodes > for one upper inode? If not, then the mechanism of dirtiness propagation One upper inode only belongs to one overlayfs inode. However, in practice one upper fs may contains hundreds or even thousands of overlayfs instances. > could be much simpler - it seems we could be able to just lookup > corresponding overlayfs inode based on upper inode and then mark it dirty > (but this would need to be verified by people more familiar with > overlayfs). So all we'd need to know for this is the superblock of the > overlayfs that's covering given upper filesystem... > So the difficulty is how we get overlayfs inode efficiently from upper inode, it seems if we don't have additional info of upper inode to indicate which overlayfs it belongs to, then the lookup of corresponding overlayfs inode will be quite expensive and probably impact write performance. Is that possible we extend inotify infrastructure slightly to notify both user space and kernel component? Thanks, Chengguang