Re: [PATCH v3 1/2] exfat: add exfat_update_inode()

From: Tetsuhiro Kohada
Date: Wed Oct 07 2020 - 04:13:37 EST


Thank you for your reply.

new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime =
EXFAT_I(new_dir)->i_crtime = current_time(new_dir);
exfat_truncate_atime(&new_dir->i_atime);
- if (IS_DIRSYNC(new_dir))
- exfat_sync_inode(new_dir);
- else
- mark_inode_dirty(new_dir);
+ exfat_update_inode(new_dir);

i_pos = ((loff_t)EXFAT_I(old_inode)->dir.dir << 32) |
(EXFAT_I(old_inode)->entry & 0xffffffff);
exfat_unhash_inode(old_inode);
exfat_hash_inode(old_inode, i_pos);
- if (IS_DIRSYNC(new_dir))
- exfat_sync_inode(old_inode);
- else
- mark_inode_dirty(old_inode);
+ exfat_update_inode(old_inode);
This is checking if old_inode is IS_DIRSYNC, not new_dir.
Is there any reason ?

To eliminate meaningless usage and simplify it.

Th exfat does not have an attribute that indicates whether each file/dir should be synced(such as ext4).
Therefore, sync necessity cannot be set for each inode, so sync necessity of the whole FS setting(sb-> s_flags) is inherited.
As a result, the following values ​​are all the same.
IS_DIRSYNC (new_dir)
IS_DIRSYNC (old_dir)
IS_DIRSYNC (old_inode)
sb-> s_flags & SB_SYNCHRONOUS | SB_DIRSYNC

In exfat, IS_DIRSYNC only works as a shortcut to sb->s_flags.

Even if S_SYNC or S_DIRSYNC were set to inode->i_flags, the current implementation is inappropriate.
Whether to sync or not should be determined by "IS_DIRSYNC(new_dir)||IS_DIRSYNC(old_dir)", I think.
(Syncing only old_dir is a high risk of losing file)

Whatever, no one sets S_SYNC and S_DIRSYNC in exfat, so the behavior is no different.

***
Please tell me your opinion about "aggregate dir-entry updates into __exfat_write_inode()"

BR
---
Tetsuhiro Kohada <kohada.t2@xxxxxxxxx>