RE: [PATCH] exfat: do not clear VolumeDirty in writeback
From: Kohada.Tetsuhiro@xxxxxxxxxxxxxxxxxxxxxxxxxxx
Date: Mon Feb 28 2022 - 02:34:07 EST
Hi, Yuezhang.
> And VolumeDirty will be set again when updating the parent directory. It means that BootSector will be written twice in
> each writeback, that will shorten the life of the device.
I have the same concern.
>From a lifespan point of view, we should probably clear dirty with just sync_fs().
> sync_blockdev(sb->s_bdev);
> - if (exfat_clear_volume_dirty(sb))
> + if (__exfat_clear_volume_dirty(sb))
If SB_SYNCHRONOUS or SB_DIRSYNC is not present, isn't dirty cleared?
> +int exfat_clear_volume_dirty(struct super_block *sb) {
> + if (sb->s_flags & (SB_SYNCHRONOUS | SB_DIRSYNC))
> + return __exfat_clear_volume_dirty(sb);
Even when only one of SB or DIR is synced, dirty will be cleared.
Isn't it necessary to have both SB_SYNCHRONOUS and SB_DIRSYNC?
And, I think it would be better to use IS_SYNC or IS_DIRSYNC macro here.
BR