From 008cac84fb75ce3e6955d99faae35af155c96554 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 18 Nov 2007 14:08:44 +0000 Subject: [PATCH] atime update works (Yura Pakhuchiy, Szabolcs Szakacsits) --- include/ntfs-3g/volume.h | 18 +----------------- libntfs-3g/volume.c | 10 +++------- src/ntfs-3g.c | 13 +++---------- 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/include/ntfs-3g/volume.h b/include/ntfs-3g/volume.h index b9f8023a..c4fb9df5 100644 --- a/include/ntfs-3g/volume.h +++ b/include/ntfs-3g/volume.h @@ -43,23 +43,12 @@ #endif /* - * Under Cygwin, DJGPP and FreeBSD we do not have MS_RDONLY and MS_NOATIME, + * Under Cygwin, DJGPP and FreeBSD we do not have MS_RDONLY, * so we define them ourselves. */ #ifndef MS_RDONLY #define MS_RDONLY 1 #endif -/* - * Solaris defines MS_RDONLY but not MS_NOATIME thus we need to carefully - * define MS_NOATIME. - */ -#ifndef MS_NOATIME -#if (MS_RDONLY != 1) -# define MS_NOATIME 1 -#else -# define MS_NOATIME 2 -#endif -#endif #define MS_EXCLUSIVE 0x08000000 @@ -98,7 +87,6 @@ typedef enum { NV_ReadOnly, /* 1: Volume is read-only. */ NV_CaseSensitive, /* 1: Volume is mounted case-sensitive. */ NV_LogFileEmpty, /* 1: $logFile journal is empty. */ - NV_NoATime, /* 1: Do not update access time. */ } ntfs_volume_state_bits; #define test_nvol_flag(nv, flag) test_bit(NV_##flag, (nv)->state) @@ -117,10 +105,6 @@ typedef enum { #define NVolSetLogFileEmpty(nv) set_nvol_flag(nv, LogFileEmpty) #define NVolClearLogFileEmpty(nv) clear_nvol_flag(nv, LogFileEmpty) -#define NVolNoATime(nv) test_nvol_flag(nv, NoATime) -#define NVolSetNoATime(nv) set_nvol_flag(nv, NoATime) -#define NVolClearNoATime(nv) clear_nvol_flag(nv, NoATime) - /* * NTFS version 1.1 and 1.2 are used by Windows NT4. * NTFS version 2.x is used by Windows 2000 Beta diff --git a/libntfs-3g/volume.c b/libntfs-3g/volume.c index 030640da..699c2dd2 100644 --- a/libntfs-3g/volume.c +++ b/libntfs-3g/volume.c @@ -457,8 +457,6 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags) if (flags & MS_RDONLY) NVolSetReadOnly(vol); - if (flags & MS_NOATIME) - NVolSetNoATime(vol); /* ...->open needs bracketing to compile with glibc 2.7 */ if ((dev->d_ops->open)(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) { @@ -739,10 +737,9 @@ out: * to mount as the ntfs volume. * * @flags is an optional second parameter. The same flags are used as for - * the mount system call (man 2 mount). Currently only the following flags - * are implemented: + * the mount system call (man 2 mount). Currently only the following flag + * is implemented: * MS_RDONLY - mount volume read-only - * MS_NOATIME - do not update access time * * The function opens the device @dev and verifies that it contains a valid * bootsector. Then, it allocates an ntfs_volume structure and initializes @@ -1136,9 +1133,8 @@ error_exit: * * @flags is an optional second parameter. The same flags are used as for * the mount system call (man 2 mount). Currently only the following flags - * are implemented: + * is implemented: * MS_RDONLY - mount volume read-only - * MS_NOATIME - do not update access time * * The function opens the device or file @name and verifies that it contains a * valid bootsector. Then, it allocates an ntfs_volume structure and initializes diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index cdb94475..bd6a6ce7 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -1210,7 +1210,7 @@ static int ntfs_fuse_utime(const char *path, struct utimbuf *buf) ni->last_data_change_time = buf->modtime; ntfs_fuse_update_times(ni, NTFS_UPDATE_CTIME); } else - ntfs_fuse_update_times(ni, NTFS_UPDATE_AMCTIME); + ntfs_inode_update_times(ni, NTFS_UPDATE_AMCTIME); if (ntfs_inode_close(ni)) set_fuse_error(&res); @@ -1620,8 +1620,6 @@ static int ntfs_open(const char *device, char *mntpoint) flags |= MS_EXCLUSIVE; if (ctx->ro) flags |= MS_RDONLY; - if (ctx->noatime) - flags |= MS_NOATIME; if (ctx->force) flags |= MS_FORCE; @@ -1676,13 +1674,6 @@ static char *parse_mount_options(const char *orig_opts) return NULL; } - /* - * FIXME: Due to major performance hit and interference - * issues, always use the 'noatime' options for now. - */ - ctx->noatime = TRUE; - strcat(ret, "noatime,"); - ctx->silent = TRUE; s = options; @@ -1702,6 +1693,8 @@ static char *parse_mount_options(const char *orig_opts) "have value.\n"); goto err_exit; } + ctx->noatime = TRUE; + strcat(ret, "noatime,"); } else if (!strcmp(opt, "fake_rw")) { if (val) { ntfs_log_error("'fake_rw' option should not "