Re: [PATCH 2/2 V2] exfat: truncate atimes to 2s granularity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2020-04-19 2:06 GMT+09:00, Eric Sandeen <sandeen@xxxxxxxxxxx>:
>
>
> On 4/18/20 11:40 AM, Eric Sandeen wrote:
>> On 4/18/20 11:04 AM, Eric Sandeen wrote:
>>> since access_time has no corresponding 10msIncrement field, my
>>> understanding was that it could only have a 2s granularity.
>>
>> Maybe your concern is whether the other _time fields should also be
>> truncated to 2s even though they have the _ms field?  I don't think so;
>> the
>> s_time_gran already limits in-core timestamp resolution to 10ms, which
>> will
>> be properly translated when the inode is written to disk.
>>
>> atime has a different granularity though, so s_time_gran doens't help and
>> we
>> must manually change it to 2s whenever we call something like
>> current_time(), which
>> only enforces the 10ms granularity.
>>
>> So for cases like this:
>>
>>  	generic_fillattr(inode, stat);
>> +	exfat_truncate_atime(&stat->atime);
>>
>> or this:
>>
>>  	inode->i_mtime = inode->i_atime = inode->i_ctime =
>>  		EXFAT_I(inode)->i_crtime = current_time(inode);
>> +	exfat_truncate_atime(&inode->i_atime);
>>
>> I think it's clearly the right thing to do; anything finer than 2s will be
>> thrown
>> away when the vfs inode atime is translated to the disk format, so we
>> should never
>> hold finer granularity in the in-memory vfs inode.
>>
>> However, in exfat_get_entry_time() maybe all we need to do is set
>> ts->tv_nsec to 0;
>> that might be clearer.
>
> so maybe this is better -
>
> diff --git a/fs/exfat/misc.c b/fs/exfat/misc.c
> index c8b33278d474..2c5629b4e7e6 100644
> --- a/fs/exfat/misc.c
> +++ b/fs/exfat/misc.c
> @@ -89,7 +89,7 @@ void exfat_get_entry_time(struct exfat_sb_info *sbi,
> struct timespec64 *ts,
>  		ts->tv_sec += time_ms / 100;
>  		ts->tv_nsec = (time_ms % 100) * 10 * NSEC_PER_MSEC;
>  	} else
> -		exfat_truncate_atime(ts);
> +		ts->tv_nsec = 0;
>
>  	if (tz & EXFAT_TZ_VALID)
>  		/* Adjust timezone to UTC0. */
>
>
> because the conversion should already limit tv_sec to a 2s granularity.
Right. I will update it and replace it with old one.
Thanks!
>
> -Eric
>



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux