set MS_NOATIME on FAT ?
Subsystems (2)
RFC 1/1 set MS_NOATIME on FAT ?
Hi,
as far as I can tell, none of FAT or its offsprings use atime, so perhaps fs/fat/inode.c should just set MS_NOATIME, so that we don't get unnecessary "inode" writes ? (They hurt if you want to reduce worst-case latency in the write path.)
Here's a patch for 2.6.11 (with some offset, because I pulled it from a larger patch).
Does this look good ?
Thanks,
- Werner
---------------------------------- cut here -----------------------------------
fs/fat/inode.c +2 -2
@@ -413,7 +483,7 @@ static void __exit fat_destroy_inodecachstatic int fat_remount (struct super_block *sb,int *flags,char *data) { - *flags |=MS_NODIRATIME ; + *flags |=MS_NODIRATIME |MS_NOATIME ;return 0 ; }
@@ -1058,7 +1128,7 @@ int fat_fill_super(struct super_block *s sb->s_fs_info = sbi;memset (sbi,0 ,sizeof (struct msdos_sb_info )); - sb->s_flags |=MS_NODIRATIME ; + sb->s_flags |=MS_NODIRATIME |MS_NOATIME ; sb->s_magic =MSDOS_SUPER_MAGIC ; sb->s_op = &fat_sops; sb->s_export_op = &fat_export_ops;
Signature · 3 lines
_________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina [email protected] / /_http://www.almesberger.net/____________________________________________/
OGAWA Hirofumi
maintainerQuoted 3 lines · Werner Almesberger
as far as I can tell, none of FAT or its offsprings use atime, so perhaps
fs/fat/inode.cshould just setMS_NOATIME, so that we don't get unnecessary "inode" writes ?
No. The fatfs has the ->adate, so I think we should update it rather.
Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 1 line · OGAWA Hirofumi
No. The fatfs has the ->adate, so I think we should update it rather.
Ah, I see. But, at the moment, VFAT doesn't set atime from adate, and vice versa, or have I overlooked something ?
Thanks,
- Werner
Signature · 3 lines
_________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina [email protected] / /_http://www.almesberger.net/____________________________________________/
OGAWA Hirofumi
maintainerQuoted 2 lines · Werner Almesberger
Ah, I see. But, at the moment, VFAT doesn't set atime from adate, and vice versa, or have I overlooked something ?
Right. However, if you need NOATIME, you can set it with mount options. And I think, we just need to fix ->adate, no need to change default options.
Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 2 lines · OGAWA Hirofumi
Right. However, if you need NOATIME, you can set it with mount options.
Yes, of course. It just seems clearer to me to avoid the useless "inode" writes by default.
Quoted 2 lines
And I think, we just need to fix ->adate, no need to change default options.
In the case of non-VFAT, there's also the issue that pretending to support atime causes atime to jump back and forth unpredictably, depending on when the inode is evicted from memory. (And the low adate resolution means that even VFAT will have a similar problem.)
But I guess if nobody complained in the last twelve or so years, we're in no hurry to fix that ;-) (And in case we are, patch below.)
Thanks,
- Werner
---------------------------------- cut here -----------------------------------
fs/fat/inode.c +4 -0
@@ -414,6 +484,8 @@ static void __exit fat_destroy_inodecachstatic int fat_remount (struct super_block *sb,int *flags,char *data) { *flags |=MS_NODIRATIME ; +if (!MSDOS_SB (sb)->options.isvfat) + *flags |=MS_NOATIME ;return 0 ; }
@@ -1059,6 +1131,8 @@ int fat_fill_super(struct super_block *smemset (sbi,0 ,sizeof (struct msdos_sb_info )); sb->s_flags |=MS_NODIRATIME ; +if (!isvfat) + sb->s_flags |=MS_NOATIME ; sb->s_magic =MSDOS_SUPER_MAGIC ; sb->s_op = &fat_sops; sb->s_export_op = &fat_export_ops;
Signature · 3 lines
_________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina [email protected] / /_http://www.almesberger.net/____________________________________________/
OGAWA Hirofumi
maintainerQuoted 4 lines · Werner Almesberger
In the case of non-VFAT, there's also the issue that pretending to support atime causes atime to jump back and forth unpredictably, depending on when the inode is evicted from memory. (And the low adate resolution means that even VFAT will have a similar problem.)
Yes. We would need to add something to timespec_trunc() for it. And unfortunately de->time too.
Quoted 2 lines
But I guess if nobody complained in the last twelve or so years, we're in no hurry to fix that ;-)
Thanks. :)
fs/fat/inode.c int fat_fill_super(struct super_block *s · line 1138
Quoted 9 lines
fs/fat/inode.c +2
-0@@ -1059,6 +1131,8 @@ int fat_fill_super(struct super_block *smemset (sbi,0 ,sizeof (struct msdos_sb_info )); sb->s_flags |=MS_NODIRATIME ; +if (!isvfat) + sb->s_flags |=MS_NOATIME ; sb->s_magic =MSDOS_SUPER_MAGIC ; sb->s_op = &fat_sops; sb->s_export_op = &fat_export_ops;
Looks good to me. But, I don't know whether actually DOS updates ->adate or not. It would depend on it.
Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 2 lines · OGAWA Hirofumi
Looks good to me. But, I don't know whether actually DOS updates ->adate or not. It would depend on it.
According to http://home.no.net/tkos/info/fat.html, it's a new addition with VFAT. Wikipedia (http://en.wikipedia.org/wiki/VFAT)
doesn't say anything, but seems in general relatively silent about FAT versions in the description of the directory entries.
There might also be useful information in the FAT specification at
http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx
but it seems to me that you'll need to have your IP laywers go over their very weird download license a few time before you can know if it's dangerous to read or not :-(
In any case, adate clearly didn't exist in older DOS versions, so there are cases where you don't want to touch adate. An in all these, it should always be correct to set noatime.
Thanks,
- Werner
Signature · 3 lines
_________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina [email protected] / /_http://www.almesberger.net/____________________________________________/
OGAWA Hirofumi
maintainerWerner Almesberger <[email protected]> writes:
Also it seems aeb's site indicates it was filled by zero. I'll apply the patch, and will move the following part to msdos/namei.c.
@@ -1059,6 +1131,8 @@ int fat_fill_super(struct super_block *s
memset(sbi, 0, sizeof(struct msdos_sb_info));
sb->s_flags |= MS_NODIRATIME;
+ if (!isvfat)
+ sb->s_flags |= MS_NOATIME;
sb->s_magic = MSDOS_SUPER_MAGIC;
sb->s_op = &fat_sops;
sb->s_export_op = &fat_export_ops;
Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>