All of lore.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Chung-Chiang Cheng <cccheng@synology.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, shepjeng@gmail.com,
	kernel@cccheng.net
Subject: Re: [PATCH v6 4/4] fat: remove time truncations in vfat_create/vfat_mkdir
Date: Sun, 15 May 2022 23:00:34 +0900	[thread overview]
Message-ID: <87h75qlwu5.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <20220503152536.2503003-4-cccheng@synology.com> (Chung-Chiang Cheng's message of "Tue, 3 May 2022 23:25:36 +0800")

Chung-Chiang Cheng <cccheng@synology.com> writes:

> All the timestamps in vfat_create() and vfat_mkdir() come from
> fat_time_fat2unix() which ensures time granularity. We don't need to
> truncate them to fit FAT's format.
>
> Moreover, fat_truncate_crtime() and fat_timespec64_trunc_10ms() are
> also removed because there is no caller anymore.

Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

Thanks.

> Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com>
> ---
>  fs/fat/fat.h        |  2 --
>  fs/fat/misc.c       | 21 ---------------------
>  fs/fat/namei_vfat.c |  4 ----
>  3 files changed, 27 deletions(-)
>
> diff --git a/fs/fat/fat.h b/fs/fat/fat.h
> index f3bbf17ee352..47b90deef284 100644
> --- a/fs/fat/fat.h
> +++ b/fs/fat/fat.h
> @@ -449,8 +449,6 @@ extern void fat_time_unix2fat(struct msdos_sb_info *sbi, struct timespec64 *ts,
>  			      __le16 *time, __le16 *date, u8 *time_cs);
>  extern struct timespec64 fat_truncate_atime(const struct msdos_sb_info *sbi,
>  					    const struct timespec64 *ts);
> -extern struct timespec64 fat_truncate_crtime(const struct msdos_sb_info *sbi,
> -					     const struct timespec64 *ts);
>  extern struct timespec64 fat_truncate_mtime(const struct msdos_sb_info *sbi,
>  					    const struct timespec64 *ts);
>  extern int fat_truncate_time(struct inode *inode, struct timespec64 *now,
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index 85bb9dc3af2d..010865dfc46b 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -275,13 +275,6 @@ static inline struct timespec64 fat_timespec64_trunc_2secs(struct timespec64 ts)
>  	return (struct timespec64){ ts.tv_sec & ~1ULL, 0 };
>  }
>  
> -static inline struct timespec64 fat_timespec64_trunc_10ms(struct timespec64 ts)
> -{
> -	if (ts.tv_nsec)
> -		ts.tv_nsec -= ts.tv_nsec % 10000000UL;
> -	return ts;
> -}
> -
>  /*
>   * truncate atime to 24 hour granularity (00:00:00 in local timezone)
>   */
> @@ -299,20 +292,6 @@ struct timespec64 fat_truncate_atime(const struct msdos_sb_info *sbi,
>  	return (struct timespec64){ seconds, 0 };
>  }
>  
> -/*
> - * truncate creation time with appropriate granularity:
> - *   msdos - 2 seconds
> - *   vfat  - 10 milliseconds
> - */
> -struct timespec64 fat_truncate_crtime(const struct msdos_sb_info *sbi,
> -				      const struct timespec64 *ts)
> -{
> -	if (sbi->options.isvfat)
> -		return fat_timespec64_trunc_10ms(*ts);
> -	else
> -		return fat_timespec64_trunc_2secs(*ts);
> -}
> -
>  /*
>   * truncate mtime to 2 second granularity
>   */
> diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
> index 5369d82e0bfb..c573314806cf 100644
> --- a/fs/fat/namei_vfat.c
> +++ b/fs/fat/namei_vfat.c
> @@ -780,8 +780,6 @@ static int vfat_create(struct user_namespace *mnt_userns, struct inode *dir,
>  		goto out;
>  	}
>  	inode_inc_iversion(inode);
> -	fat_truncate_time(inode, &ts, S_ATIME|S_CTIME|S_MTIME);
> -	/* timestamp is already written, so mark_inode_dirty() is unneeded. */
>  
>  	d_instantiate(dentry, inode);
>  out:
> @@ -878,8 +876,6 @@ static int vfat_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
>  	}
>  	inode_inc_iversion(inode);
>  	set_nlink(inode, 2);
> -	fat_truncate_time(inode, &ts, S_ATIME|S_CTIME|S_MTIME);
> -	/* timestamp is already written, so mark_inode_dirty() is unneeded. */
>  
>  	d_instantiate(dentry, inode);

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2022-05-15 14:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 15:25 [PATCH v6 1/4] fat: split fat_truncate_time() into separate functions Chung-Chiang Cheng
2022-05-03 15:25 ` [PATCH v6 2/4] fat: ignore ctime updates, and keep ctime identical to mtime in memory Chung-Chiang Cheng
2022-05-15 14:00   ` OGAWA Hirofumi
2022-05-03 15:25 ` [PATCH v6 3/4] fat: report creation time in statx Chung-Chiang Cheng
2022-05-15 14:00   ` OGAWA Hirofumi
2022-05-03 15:25 ` [PATCH v6 4/4] fat: remove time truncations in vfat_create/vfat_mkdir Chung-Chiang Cheng
2022-05-15 14:00   ` OGAWA Hirofumi [this message]
2022-05-15 13:59 ` [PATCH v6 1/4] fat: split fat_truncate_time() into separate functions OGAWA Hirofumi

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=87h75qlwu5.fsf@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=cccheng@synology.com \
    --cc=kernel@cccheng.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=shepjeng@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.