public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] set MS_NOATIME on FAT ?
@ 2005-03-15  2:20 Werner Almesberger
  2005-03-15  3:56 ` OGAWA Hirofumi
  0 siblings, 1 reply; 8+ messages in thread
From: Werner Almesberger @ 2005-03-15  2:20 UTC (permalink / raw)
  To: hirofumi; +Cc: linux-fsdevel

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 -----------------------------------

Signed-off-by: Werner Almesberger <werner@almesberger.net>

--- linux-2.6.11-orig/fs/fat/inode.c	Wed Mar  2 04:38:08 2005
+++ linux-2.6.11/fs/fat/inode.c	Thu Mar  3 01:35:57 2005
@@ -413,7 +483,7 @@ static void __exit fat_destroy_inodecach
 
 static 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;

-- 
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina     werner@almesberger.net /
/_http://www.almesberger.net/____________________________________________/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] set MS_NOATIME on FAT ?
  2005-03-15  2:20 [RFC] set MS_NOATIME on FAT ? Werner Almesberger
@ 2005-03-15  3:56 ` OGAWA Hirofumi
  2005-03-15  4:18   ` Werner Almesberger
  0 siblings, 1 reply; 8+ messages in thread
From: OGAWA Hirofumi @ 2005-03-15  3:56 UTC (permalink / raw)
  To: Werner Almesberger; +Cc: linux-fsdevel

Werner Almesberger <werner@almesberger.net> writes:

> 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 ?

No. The fatfs has the ->adate, so I think we should update it rather.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] set MS_NOATIME on FAT ?
  2005-03-15  3:56 ` OGAWA Hirofumi
@ 2005-03-15  4:18   ` Werner Almesberger
  2005-03-15  5:08     ` OGAWA Hirofumi
  0 siblings, 1 reply; 8+ messages in thread
From: Werner Almesberger @ 2005-03-15  4:18 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: linux-fsdevel

OGAWA Hirofumi wrote:
> 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

-- 
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina     werner@almesberger.net /
/_http://www.almesberger.net/____________________________________________/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] set MS_NOATIME on FAT ?
  2005-03-15  4:18   ` Werner Almesberger
@ 2005-03-15  5:08     ` OGAWA Hirofumi
  2005-03-15 11:04       ` Werner Almesberger
  0 siblings, 1 reply; 8+ messages in thread
From: OGAWA Hirofumi @ 2005-03-15  5:08 UTC (permalink / raw)
  To: Werner Almesberger; +Cc: linux-fsdevel

Werner Almesberger <werner@almesberger.net> writes:

> 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.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] set MS_NOATIME on FAT ?
  2005-03-15  5:08     ` OGAWA Hirofumi
@ 2005-03-15 11:04       ` Werner Almesberger
  2005-03-15 15:58         ` OGAWA Hirofumi
  0 siblings, 1 reply; 8+ messages in thread
From: Werner Almesberger @ 2005-03-15 11:04 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: linux-fsdevel

OGAWA Hirofumi wrote:
> 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.

> 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 -----------------------------------

Signed-off-by: Werner Almesberger <werner@almesberger.net>

--- linux-2.6.11-orig/fs/fat/inode.c	Wed Mar  2 04:38:08 2005
+++ linux-2.6.11/fs/fat/inode.c	Tue Mar 15 07:35:06 2005
@@ -414,6 +484,8 @@ static void __exit fat_destroy_inodecach
 static 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 *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;

-- 
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina     werner@almesberger.net /
/_http://www.almesberger.net/____________________________________________/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] set MS_NOATIME on FAT ?
  2005-03-15 11:04       ` Werner Almesberger
@ 2005-03-15 15:58         ` OGAWA Hirofumi
  2005-03-15 17:13           ` Werner Almesberger
  0 siblings, 1 reply; 8+ messages in thread
From: OGAWA Hirofumi @ 2005-03-15 15:58 UTC (permalink / raw)
  To: Werner Almesberger; +Cc: linux-fsdevel

Werner Almesberger <werner@almesberger.net> writes:

> 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.

> But I guess if nobody complained in the last twelve or so years,
> we're in no hurry to fix that ;-)

Thanks. :)

> @@ -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;

Looks good to me. But, I don't know whether actually DOS updates ->adate
or not. It would depend on it.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] set MS_NOATIME on FAT ?
  2005-03-15 15:58         ` OGAWA Hirofumi
@ 2005-03-15 17:13           ` Werner Almesberger
  2005-03-15 18:18             ` OGAWA Hirofumi
  0 siblings, 1 reply; 8+ messages in thread
From: Werner Almesberger @ 2005-03-15 17:13 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: linux-fsdevel

OGAWA Hirofumi wrote:
> 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

-- 
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina     werner@almesberger.net /
/_http://www.almesberger.net/____________________________________________/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] set MS_NOATIME on FAT ?
  2005-03-15 17:13           ` Werner Almesberger
@ 2005-03-15 18:18             ` OGAWA Hirofumi
  0 siblings, 0 replies; 8+ messages in thread
From: OGAWA Hirofumi @ 2005-03-15 18:18 UTC (permalink / raw)
  To: Werner Almesberger; +Cc: linux-fsdevel

Werner Almesberger <werner@almesberger.net> 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.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-03-15 18:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-15  2:20 [RFC] set MS_NOATIME on FAT ? Werner Almesberger
2005-03-15  3:56 ` OGAWA Hirofumi
2005-03-15  4:18   ` Werner Almesberger
2005-03-15  5:08     ` OGAWA Hirofumi
2005-03-15 11:04       ` Werner Almesberger
2005-03-15 15:58         ` OGAWA Hirofumi
2005-03-15 17:13           ` Werner Almesberger
2005-03-15 18:18             ` OGAWA Hirofumi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox