[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <HK2PR04MB3891B4F1C2BC707582E81C0C81019@HK2PR04MB3891.apcprd04.prod.outlook.com>
Date: Mon, 28 Feb 2022 10:51:54 +0000
From: "Yuezhang.Mo@...y.com" <Yuezhang.Mo@...y.com>
To: "Kohada.Tetsuhiro@...MitsubishiElectric.co.jp"
<Kohada.Tetsuhiro@...MitsubishiElectric.co.jp>,
"linkinjeon@...nel.org" <linkinjeon@...nel.org>,
"sj1557.seo@...sung.com" <sj1557.seo@...sung.com>
CC: "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] exfat: do not clear VolumeDirty in writeback
Hi, Kohada.Tetsuhiro.
Thank for your comments.
>> 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().
If it is acceptable for VolumeDirty to remain dirty after all updates are complete, I think it is a good idea.
(PS: The original logic is to clear VolumeDirty after BitMap, FAT and directory entries are updated.)
>> 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?
With this patch, exfat_clear_volume_dirty() will not clear VolumeDirty if SB_SYNCHRONOUS or SB_DIRSYNC is not present, and __exfat_clear_volume_dirty() will clear VolumeDirty unconditionally.
>> +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?
VolumeDirty will be cleared if one of SB_SYNCHRONOUS and SB_DIRSYNC is set.
The condition of (sb->s_flags & (SB_SYNCHRONOUS | SB_DIRSYNC)) is exactly that.
> And, I think it would be better to use IS_SYNC or IS_DIRSYNC macro here.
If use IS_SYNC or IS_DIRSYNC, we should pass `inode` as an argument, it will be a big change for code.
And if open a file with O_SYNC, IS_DIRSYNC and IS_SYNC will be true, VolumeDirty will be cleared.
So I think it is not necessary to use IS_DIRSYNC and IS_SYNC.
Best Regards,
Yuezhang,Mo
Powered by blists - more mailing lists