lkml.org 
[lkml]   [2022]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] exfat: do not clear VolumeDirty in writeback
Date
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
\
 
 \ /
  Last update: 2022-02-28 11:56    [W:0.100 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site