> This isn't missed, this is just not going in.
>
> It's not that I don't like NO_ATIME, but look into 2.1.x for a NO_ATIME
> that I actually accept.
>
> This one adds lots of #ifdef's to code. That is not acceptable in my book,
How about this one, is it acceptable? It was backported straight from
2.1.4x ...
BTW, I didn't bother to port the changes for minixfs. People who use it
and need the NO_ATIME feature deserve exactly what they're getting.
Ionut
--
It is better to keep your mouth shut and be thought a fool,
than to open it and remove all doubt.
diff -u --recursive --new-file linux-2.0.31-3/drivers/char/random.c linux/drivers/char/random.c
--- linux-2.0.31-3/drivers/char/random.c Tue Apr 8 11:47:45 1997
+++ linux/drivers/char/random.c Wed Aug 6 19:49:43 1997
@@ -1071,10 +1071,8 @@
* If we gave the user some bytes and we have an inode pointer,
* update the access time.
*/
- if (inode && count != 0) {
- inode->i_atime = CURRENT_TIME;
- inode->i_dirt = 1;
- }
+ if (inode && count != 0)
+ UPDATE_ATIME(inode);
return (count ? count : retval);
}
diff -u --recursive --new-file linux-2.0.31-3/fs/ext2/dir.c linux/fs/ext2/dir.c
--- linux-2.0.31-3/fs/ext2/dir.c Fri Dec 22 06:00:19 1995
+++ linux/fs/ext2/dir.c Wed Aug 6 19:49:45 1997
@@ -206,9 +206,6 @@
offset = 0;
brelse (bh);
}
- if (!IS_RDONLY(inode)) {
- inode->i_atime = CURRENT_TIME;
- inode->i_dirt = 1;
- }
+ UPDATE_ATIME(inode);
return 0;
}
diff -u --recursive --new-file linux-2.0.31-3/fs/ext2/inode.c linux/fs/ext2/inode.c
--- linux-2.0.31-3/fs/ext2/inode.c Tue Mar 11 16:46:41 1997
+++ linux/fs/ext2/inode.c Tue Aug 5 21:24:17 1997
@@ -504,6 +504,8 @@
inode->i_flags |= S_APPEND;
if (inode->u.ext2_i.i_flags & EXT2_IMMUTABLE_FL)
inode->i_flags |= S_IMMUTABLE;
+ if (inode->u.ext2_i.i_flags & EXT2_NOATIME_FL)
+ inode->i_flags |= MS_NOATIME;
}
static int ext2_update_inode(struct inode * inode, int do_sync)
diff -u --recursive --new-file linux-2.0.31-3/fs/ext2/ioctl.c linux/fs/ext2/ioctl.c
--- linux-2.0.31-3/fs/ext2/ioctl.c Tue Jul 2 12:08:42 1996
+++ linux/fs/ext2/ioctl.c Tue Aug 5 21:26:01 1997
@@ -60,6 +60,10 @@
inode->i_flags |= S_IMMUTABLE;
else
inode->i_flags &= ~S_IMMUTABLE;
+ if (flags & EXT2_NOATIME_FL)
+ inode->i_flags |= MS_NOATIME;
+ else
+ inode->i_flags &= ~MS_NOATIME;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1;
return 0;
diff -u --recursive --new-file linux-2.0.31-3/fs/ext2/symlink.c linux/fs/ext2/symlink.c
--- linux-2.0.31-3/fs/ext2/symlink.c Fri Apr 12 03:33:26 1996
+++ linux/fs/ext2/symlink.c Wed Aug 6 19:50:49 1997
@@ -86,10 +86,7 @@
link = bh->b_data;
} else
link = (char *) inode->u.ext2_i.i_data;
- if (!IS_RDONLY(inode)) {
- inode->i_atime = CURRENT_TIME;
- inode->i_dirt = 1;
- }
+ UPDATE_ATIME(inode);
current->link_count++;
error = open_namei (link, flag, mode, res_inode, dir);
current->link_count--;
@@ -127,10 +124,7 @@
i++;
put_user (c, buffer++);
}
- if (!IS_RDONLY(inode)) {
- inode->i_atime = CURRENT_TIME;
- inode->i_dirt = 1;
- }
+ UPDATE_ATIME(inode);
iput (inode);
if (bh)
brelse (bh);
diff -u --recursive --new-file linux-2.0.31-3/fs/pipe.c linux/fs/pipe.c
--- linux-2.0.31-3/fs/pipe.c Sun Jul 7 13:27:04 1996
+++ linux/fs/pipe.c Wed Aug 6 19:51:58 1997
@@ -68,7 +68,7 @@
PIPE_LOCK(*inode)--;
wake_up_interruptible(&PIPE_WAIT(*inode));
if (read) {
- inode->i_atime = CURRENT_TIME;
+ UPDATE_ATIME(inode);
return read;
}
if (PIPE_WRITERS(*inode))
diff -u --recursive --new-file linux-2.0.31-3/fs/stat.c linux/fs/stat.c
--- linux-2.0.31-3/fs/stat.c Sat Feb 17 02:19:41 1996
+++ linux/fs/stat.c Wed Aug 6 19:54:58 1997
@@ -235,5 +235,6 @@
iput(inode);
return -EINVAL;
}
+ UPDATE_ATIME(inode);
return inode->i_op->readlink(inode,buf,bufsiz);
}
diff -u --recursive --new-file linux-2.0.31-3/fs/super.c linux/fs/super.c
--- linux-2.0.31-3/fs/super.c Wed Aug 6 20:09:07 1997
+++ linux/fs/super.c Tue Aug 5 21:39:48 1997
@@ -278,6 +278,7 @@
{ MS_NODEV, ",nodev" },
{ MS_SYNCHRONOUS, ",sync" },
{ MS_MANDLOCK, ",mand" },
+ { MS_NOATIME, ",noatime" },
#ifdef MS_NOSUB /* Can't find this except in mount.c */
{ MS_NOSUB, ",nosub" },
#endif
diff -u --recursive --new-file linux-2.0.31-3/include/linux/ext2_fs.h linux/include/linux/ext2_fs.h
--- linux-2.0.31-3/include/linux/ext2_fs.h Tue Apr 8 11:47:46 1997
+++ linux/include/linux/ext2_fs.h Tue Aug 5 21:27:57 1997
@@ -189,6 +189,7 @@
#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */
#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */
#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */
+#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */
#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
/*
diff -u --recursive --new-file linux-2.0.31-3/include/linux/fs.h linux/include/linux/fs.h
--- linux-2.0.31-3/include/linux/fs.h Wed Aug 6 20:09:08 1997
+++ linux/include/linux/fs.h Wed Aug 6 19:59:02 1997
@@ -73,6 +73,7 @@
#define S_WRITE 128 /* Write on file/directory/symlink */
#define S_APPEND 256 /* Append-only file */
#define S_IMMUTABLE 512 /* Immutable file */
+#define MS_NOATIME 1024 /* Do not update access times. */
/*
* Flags that can be altered by MS_REMOUNT
@@ -103,6 +104,13 @@
#define IS_WRITABLE(inode) ((inode)->i_flags & S_WRITE)
#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
+#define IS_NOATIME(inode) ((inode)->i_flags & MS_NOATIME)
+
+#define UPDATE_ATIME(inode) \
+ if (!IS_NOATIME(inode) && !IS_RDONLY(inode)) { \
+ inode->i_atime = CURRENT_TIME; \
+ inode->i_dirt = 1; \
+ }
/* the read-only stuff doesn't really belong here, but any other place is
probably as bad and I don't want to create yet another include file. */
diff -u --recursive --new-file linux-2.0.31-3/mm/filemap.c linux/mm/filemap.c
--- linux-2.0.31-3/mm/filemap.c Wed Aug 6 20:09:09 1997
+++ linux/mm/filemap.c Wed Aug 6 20:00:53 1997
@@ -736,10 +736,7 @@
filp->f_reada = 1;
if (page_cache)
free_page(page_cache);
- if (!IS_RDONLY(inode)) {
- inode->i_atime = CURRENT_TIME;
- inode->i_dirt = 1;
- }
+ UPDATE_ATIME(inode)
if (!read)
read = error;
return read;
@@ -1175,10 +1172,7 @@
return -EACCES;
if (!inode->i_op || !inode->i_op->readpage)
return -ENOEXEC;
- if (!IS_RDONLY(inode)) {
- inode->i_atime = CURRENT_TIME;
- inode->i_dirt = 1;
- }
+ UPDATE_ATIME(inode)
vma->vm_inode = inode;
inode->i_count++;
vma->vm_ops = ops;