Hi,
The --noatime option of libdiskfs can be used to drop the update of the
atime field, which speeds I/O up. However, ext2fs, fatfs and ufs don't
honour that option for directories: they always update the atime. Here
is a patch that adds a common libdiskfs function for setting the atime
only if noatime is not set.
Comments?
Samuel
Index: doc/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/doc/ChangeLog,v
retrieving revision 1.28
diff -u -p -r1.28 ChangeLog
--- doc/ChangeLog 16 Mar 2007 01:16:40 -0000 1.28
+++ doc/ChangeLog 16 Aug 2007 19:42:45 -0000
@@ -1,3 +1,7 @@
+2007-08-16 Samuel Thibault <[EMAIL PROTECTED]>
+
+ * hurd.texi: Document diskfs_set_node_atime.
+
2007-03-16 Ben Asselstine <[EMAIL PROTECTED]>
Thomas Schwinge <[EMAIL PROTECTED]>
Index: doc/hurd.texi
===================================================================
RCS file: /cvsroot/hurd/hurd/doc/hurd.texi,v
retrieving revision 1.28
diff -u -p -r1.28 hurd.texi
--- doc/hurd.texi 16 Mar 2007 00:50:24 -0000 1.28
+++ doc/hurd.texi 16 Aug 2007 19:35:40 -0000
@@ -3928,6 +3928,11 @@
disk allocation strategies.
@end deftypefun
[EMAIL PROTECTED] void diskfs_set_node_atime (@w{struct node [EMAIL PROTECTED])
+If disk is not readonly and the noatime option is not enabled, set
[EMAIL PROTECTED]@var{np}->dn_set_atime}.
[EMAIL PROTECTED] deftypefun
+
@deftypefun void diskfs_set_node_times (@w{struct node [EMAIL PROTECTED])
If @[EMAIL PROTECTED]>dn_set_ctime} is set, then modify
@[EMAIL PROTECTED]>dn_stat.st_ctime} appropriately; do the analogous
Index: ext2fs/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/ext2fs/ChangeLog,v
retrieving revision 1.90
--- ext2fs/ChangeLog 12 Jul 2005 15:29:22 -0000 1.90
+++ ext2fs/ChangeLog 16 Aug 2007 19:35:41 -0000
@@ -1,3 +1,8 @@
+2007-08-16 Samuel Thibault <[EMAIL PROTECTED]>
+
+ * dir.c (diskfs_lookup_hard, diskfs_dirempty): Call
+ diskfs_set_node_atime instead of setting dp->dn_set_atime.
+
2005-07-12 Marcus Brinkmann <[EMAIL PROTECTED]>
* pager.c (diskfs_get_filemap): Initialize upi->max_prot to PROT.
Index: ext2fs/dir.c
===================================================================
RCS file: /cvsroot/hurd/hurd/ext2fs/dir.c,v
retrieving revision 1.45
--- ext2fs/dir.c 10 Jan 2004 22:08:58 -0000 1.45
+++ ext2fs/dir.c 16 Aug 2007 19:35:41 -0000
@@ -196,8 +196,7 @@
inum = 0;
- if (!diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
/* Start the lookup at DP->dn->dir_idx. */
idx = dp->dn->dir_idx;
@@ -234,8 +233,7 @@
}
}
- if (!diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
if (diskfs_synchronous)
diskfs_node_update (dp, 1);
@@ -778,8 +776,7 @@
mach_port_deallocate (mach_task_self (), memobj);
assert (!err);
- if (! diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
for (curoff = buf;
!hit && curoff < buf + dp->dn_stat.st_size;
@@ -795,8 +792,7 @@
hit = 1;
}
- if (! diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
if (diskfs_synchronous)
diskfs_node_update (dp, 1);
Index: fatfs/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/fatfs/ChangeLog,v
retrieving revision 1.16
--- fatfs/ChangeLog 31 Mar 2007 10:28:03 -0000 1.16
+++ fatfs/ChangeLog 16 Aug 2007 19:35:41 -0000
@@ -1,3 +1,8 @@
+2007-08-16 Samuel Thibault <[EMAIL PROTECTED]>
+
+ * dir.c (diskfs_lookup_hard, diskfs_dirempty): Call
+ diskfs_set_node_atime instead of setting dp->dn_set_atime.
+
2007-03-31 Thomas Schwinge <[EMAIL PROTECTED]>
* Makefile (HURDLIBS): Put ``threads'' in front of ``ports''.
Index: fatfs/dir.c
===================================================================
RCS file: /cvsroot/hurd/hurd/fatfs/dir.c,v
retrieving revision 1.3
--- fatfs/dir.c 2 Aug 2003 21:32:52 -0000 1.3
+++ fatfs/dir.c 16 Aug 2007 19:35:41 -0000
@@ -231,8 +231,7 @@
inum = 0;
- if (!diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
/* Start the lookup at DP->dn->dir_idx. */
idx = dp->dn->dir_idx;
@@ -269,8 +268,7 @@
}
}
- if (!diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
if (diskfs_synchronous)
diskfs_node_update (dp, 1);
@@ -781,8 +779,7 @@
mach_port_deallocate (mach_task_self (), memobj);
assert (!err);
- if (! diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
for (curoff = buf;
!hit && curoff < buf + dp->dn_stat.st_size;
@@ -798,8 +795,7 @@
hit = 1;
}
- if (! diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
if (diskfs_synchronous)
diskfs_node_update (dp, 1);
Index: libdiskfs/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/ChangeLog,v
retrieving revision 1.189
--- libdiskfs/ChangeLog 4 Apr 2007 15:33:55 -0000 1.189
+++ libdiskfs/ChangeLog 16 Aug 2007 19:35:42 -0000
@@ -1,3 +1,8 @@
+2007-08-16 Samuel Thibault <[EMAIL PROTECTED]>
+
+ * diskfs.h (diskfs_set_node_atime): New declaration.
+ * node-times.c (diskfs_set_node_atime): New function.
+
2007-04-04 Thomas Schwinge <[EMAIL PROTECTED]>
* opts-std-startup.c (parse_startup_opt)
Index: libdiskfs/diskfs.h
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/diskfs.h,v
retrieving revision 1.98
--- libdiskfs/diskfs.h 27 Jun 2002 19:19:13 -0000 1.98
+++ libdiskfs/diskfs.h 16 Aug 2007 19:35:42 -0000
@@ -864,6 +864,10 @@
error_t
diskfs_init_dir (struct node *dp, struct node *pdp, struct protid *cred);
+/* If disk is not readonly and the noatime option is not enabled, set
+ NP->dn_set_atime. */
+void diskfs_set_node_atime (struct node *np);
+
/* If NP->dn_set_ctime is set, then modify NP->dn_stat.st_ctime
appropriately; do the analogous operation for atime and mtime as well. */
void diskfs_set_node_times (struct node *np);
Index: libdiskfs/node-times.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/node-times.c,v
retrieving revision 1.10
--- libdiskfs/node-times.c 3 Dec 2000 04:40:31 -0000 1.10
+++ libdiskfs/node-times.c 16 Aug 2007 19:35:42 -0000
@@ -22,6 +22,15 @@
#include "priv.h"
#include <maptime.h>
+/* If disk is not readonly and the noatime option is not enabled, set
+ NP->dn_set_atime. */
+void
+diskfs_set_node_atime (struct node *np)
+{
+ if (!_diskfs_noatime && !diskfs_check_readonly ())
+ np->dn_set_atime = 1;
+}
+
/* If NP->dn_set_ctime is set, then modify NP->dn_stat.st_ctime
appropriately; do the analogous operation for atime and mtime as well. */
void
Index: ufs/ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/ufs/ChangeLog,v
retrieving revision 1.48
--- ufs/ChangeLog 14 Mar 2006 23:26:37 -0000 1.48
+++ ufs/ChangeLog 16 Aug 2007 19:35:43 -0000
@@ -1,3 +1,9 @@
+2007-08-16 Samuel Thibault <[EMAIL PROTECTED]>
+
+ * dir.c (diskfs_lookup_hard, diskfs_dirempty): Call
+ diskfs_set_node_atime instead of setting dp->dn_set_atime.
+ * inode.c (read_symlink_hook): Likewise.
+
2006-03-15 Thomas Schwinge <[EMAIL PROTECTED]>
* dir.h (DIRECT_NAMELEN): Don't use ?: as a lvalue.
Index: ufs/dir.c
===================================================================
RCS file: /cvsroot/hurd/hurd/ufs/dir.c,v
retrieving revision 1.45
--- ufs/dir.c 1 Aug 2002 00:59:18 -0000 1.45
+++ ufs/dir.c 16 Aug 2007 19:35:43 -0000
@@ -162,8 +162,7 @@
inum = 0;
- if (!diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
/* Start the lookup at DP->dn->dir_idx. */
idx = dp->dn->dir_idx;
@@ -200,8 +199,7 @@
}
}
- if (!diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
if (diskfs_synchronous)
diskfs_node_update (dp, 1);
@@ -752,8 +750,7 @@
mach_port_deallocate (mach_task_self (), memobj);
assert (!err);
- if (!diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
for (curoff = buf;
curoff < buf + dp->dn_stat.st_size;
@@ -768,15 +765,13 @@
&& entry->d_name[1] != '\0')))
{
munmap ((caddr_t) buf, dp->dn_stat.st_size);
- if (!diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
if (diskfs_synchronous)
diskfs_node_update (dp, 1);
return 0;
}
}
- if (!diskfs_check_readonly ())
- dp->dn_set_atime = 1;
+ diskfs_set_node_atime (dp);
if (diskfs_synchronous)
diskfs_node_update (dp, 1);
munmap ((caddr_t) buf, dp->dn_stat.st_size);
Index: ufs/inode.c
===================================================================
RCS file: /cvsroot/hurd/hurd/ufs/inode.c,v
retrieving revision 1.59
--- ufs/inode.c 11 Jun 2002 21:41:06 -0000 1.59
+++ ufs/inode.c 16 Aug 2007 19:35:43 -0000
@@ -431,8 +431,7 @@
bcopy ((dino (np->dn->number))->di_shortlink, buf, np->dn_stat.st_size);
- if (! diskfs_check_readonly ())
- np->dn_set_atime = 1;
+ diskfs_set_node_atime (np);
diskfs_end_catch_exception ();
return 0;
_______________________________________________
Bug-hurd mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-hurd