From: Namjae Jeon <linkinjeon@kernel.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: fsdevel <linux-fsdevel@vger.kernel.org>,
Namjae Jeon <namjae.jeon@samsung.com>
Subject: Re: [PATCH 2/2 V2] exfat: truncate atimes to 2s granularity
Date: Sun, 19 Apr 2020 07:55:38 +0900 [thread overview]
Message-ID: <CAKYAXd-A5E4NFjoxuG3Y0uCVUFjZD6DjHo6j43ZYuXbUXcD+8A@mail.gmail.com> (raw)
In-Reply-To: <fd29fb6b-8c92-d4c1-a15e-4e33025175ea@sandeen.net>
2020-04-19 2:06 GMT+09:00, Eric Sandeen <sandeen@sandeen.net>:
>
>
> 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
>
next prev parent reply other threads:[~2020-04-18 22:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200416010734epcas1p38e25193dcaf42638ee8fd183afe2a112@epcas1p3.samsung.com>
2020-04-16 1:07 ` [PATCH 0/2] exfat: timestamp fixes Eric Sandeen
2020-04-16 1:09 ` [PATCH 1/2] exfat: properly set s_time_gran Eric Sandeen
2020-04-19 3:15 ` Matthew Wilcox
2020-04-20 23:28 ` Namjae Jeon
2020-04-16 1:12 ` [PATCH 2/2] exfat: zero out atime subsecond timestamp Eric Sandeen
2020-04-16 4:11 ` [PATCH 2/2 V2] exfat: truncate atimes to 2s granularity Eric Sandeen
2020-04-18 13:03 ` Namjae Jeon
2020-04-18 13:37 ` Namjae Jeon
2020-04-18 16:04 ` Eric Sandeen
2020-04-18 16:40 ` Eric Sandeen
2020-04-18 17:06 ` Eric Sandeen
2020-04-18 22:55 ` Namjae Jeon [this message]
2020-04-18 22:52 ` Namjae Jeon
2020-04-18 22:50 ` Namjae Jeon
2020-04-17 6:07 ` [PATCH 0/2] exfat: timestamp fixes Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKYAXd-A5E4NFjoxuG3Y0uCVUFjZD6DjHo6j43ZYuXbUXcD+8A@mail.gmail.com \
--to=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=namjae.jeon@samsung.com \
--cc=sandeen@sandeen.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).