[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: time coherency issue between libdiskfs and ext2fs
From: |
Thomas Schwinge |
Subject: |
Re: time coherency issue between libdiskfs and ext2fs |
Date: |
Tue, 17 Feb 2009 15:29:32 +0100 |
User-agent: |
Mutt/1.5.11 |
Hello!
On Tue, Feb 17, 2009 at 10:26:46AM +0100, I wrote:
> On Tue, Feb 10, 2009 at 02:34:16AM +0100, Samuel Thibault wrote:
> > FS to round values up (I could see that on a machine that has both
> > second- and ns-precision filesystems). Maybe we should do the same: in
> > the diskfs_S_file_utimes () and diskfs_set_node_times ()
>
> Rather than doing it every time a new value is set, what about leaving
> things internally as they are and do the normalization only on demand
> when the value is read out, i.e., in diskfs_S_io_stat? Something akin to
> libtrivfs' trivfs_modify_stat:
Here is a patch. Samuel, could you please confirm that this not only
pacifies my test program, but also your real-world scenario?
Index: ext2fs/inode.c
===================================================================
RCS file: /cvsroot/hurd/hurd/ext2fs/inode.c,v
retrieving revision 1.63
diff -u -p -r1.63 inode.c
--- ext2fs/inode.c 11 Dec 2007 12:40:22 -0000 1.63
+++ ext2fs/inode.c 17 Feb 2009 14:27:30 -0000
@@ -620,6 +620,15 @@ diskfs_write_disknode (struct node *np,
}
}
+/* The on-disk format doesn't handle nsec-precision time-stamps yet. */
+void
+diskfs_modify_stat (io_statbuf_t *s)
+{
+ s->st_atim.tv_nsec = 0;
+ s->st_mtim.tv_nsec = 0;
+ s->st_ctim.tv_nsec = 0;
+}
+
/* Set *ST with appropriate values to reflect the current state of the
filesystem. */
error_t
Index: libdiskfs/diskfs.h
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/diskfs.h,v
retrieving revision 1.102
diff -u -p -r1.102 diskfs.h
--- libdiskfs/diskfs.h 16 Feb 2009 16:05:59 -0000 1.102
+++ libdiskfs/diskfs.h 17 Feb 2009 14:27:30 -0000
@@ -287,6 +287,11 @@ extern int diskfs_default_sync_interval;
external media, then define this to be 0. */
extern char *diskfs_disk_name;
+/* The user may define this function. It is called to normalize a struct stat
+ for presentation to callers of io_stat to what the file system can actually
+ express in its on-disk format. */
+void diskfs_modify_stat (io_statbuf_t *) __attribute__ ((weak));
+
/* The user must define this function. Set *STATFSBUF with
appropriate values to reflect the current state of the filesystem.
The buffer will be initialized to all zeros by the caller;
Index: libdiskfs/io-stat.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/io-stat.c,v
retrieving revision 1.11
diff -u -p -r1.11 io-stat.c
--- libdiskfs/io-stat.c 12 Apr 2001 19:43:43 -0000 1.11
+++ libdiskfs/io-stat.c 17 Feb 2009 14:27:30 -0000
@@ -45,6 +46,9 @@ diskfs_S_io_stat (struct protid *cred,
if (cred->po->shadow_root == np || np == diskfs_root_node)
statbuf->st_mode |= S_IROOT;
+ if (diskfs_modify_stat != NULL)
+ diskfs_modify_stat (statbuf);
+
mutex_unlock (&np->lock);
return 0;
Regards,
Thomas
signature.asc
Description: Digital signature