[PATCH] fat: correct superblock flags

Yangtao Li posted 1 patch 8 months, 2 weeks ago
fs/fat/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] fat: correct superblock flags
Posted by Yangtao Li 8 months, 2 weeks ago
SB_NOATIME includes SB_NODIRATIME as a subset. Therefore,
setting SB_NOATIME is sufficient to disable atime updates
for all files and directories.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/fat/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 3852bb66358c..5da96c37386d 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -807,7 +807,7 @@ int fat_reconfigure(struct fs_context *fc)
 	bool new_rdonly;
 	struct super_block *sb = fc->root->d_sb;
 	struct msdos_sb_info *sbi = MSDOS_SB(sb);
-	fc->sb_flags |= SB_NODIRATIME | (sbi->options.isvfat ? 0 : SB_NOATIME);
+	fc->sb_flags |= sbi->options.isvfat ? SB_NODIRATIME : SB_NOATIME;
 
 	sync_filesystem(sb);
 
-- 
2.48.1
Re: [PATCH] fat: correct superblock flags
Posted by OGAWA Hirofumi 8 months, 2 weeks ago
Yangtao Li <frank.li@vivo.com> writes:

> SB_NOATIME includes SB_NODIRATIME as a subset. Therefore,
> setting SB_NOATIME is sufficient to disable atime updates
> for all files and directories.

SB_NODIRATIME is set at fat_fill_super(). So always SB_NODIRATIME looks
like it is consistent even if meaningless than removing only if remount.

Thanks.

> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  fs/fat/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
> index 3852bb66358c..5da96c37386d 100644
> --- a/fs/fat/inode.c
> +++ b/fs/fat/inode.c
> @@ -807,7 +807,7 @@ int fat_reconfigure(struct fs_context *fc)
>  	bool new_rdonly;
>  	struct super_block *sb = fc->root->d_sb;
>  	struct msdos_sb_info *sbi = MSDOS_SB(sb);
> -	fc->sb_flags |= SB_NODIRATIME | (sbi->options.isvfat ? 0 : SB_NOATIME);
> +	fc->sb_flags |= sbi->options.isvfat ? SB_NODIRATIME : SB_NOATIME;
>  
>  	sync_filesystem(sb);

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