Messages in this thread Patch in this message | | | Date | Thu, 7 Aug 1997 10:00:23 +0200 | From | Florian La Roche <> | Subject | noatime for 2.0.31 |
| |
The noatime-patch got into kernel 2.1.16. I have done the same patch for 2.0.31-3. I have added a patch for mm/filemap.c that didn't make it into 2.1.16. (It doesn't seem to be necessary for 2.1.48, as mm/filemap.c doesn't change atime anymore.) The original patch did the following: #ifdef CONFIG_EXT2_NOATIME if (inode->i_sb->s_magic==EXT2_SUPER_MAGIC) { if (!IS_RDONLY(inode) && !test_opt(inode->i_sb, NO_ATIME)) { inode->i_atime = CURRENT_TIME; inode->i_dirt = 1; } } else #endif I think that I don't have to check for an ext2 filesystem and that I can just see, if the noatime-option was given at mount-time. If that is not true, then the patch for mm/filemap.c should be left out.
Have fun,
Florian La Roche
P.S.: If someone has a list of all things that should be ported from 2.0->2.1 or 2.1->2.0, please post that list. There should be enough people who can do this job in a short time, even though they wouldn't be able to write the patch themselves.
P.S.2.: I haven't compiled the patch, but its not that big...
--- fs/ext2/dir.c +++ fs/ext2/dir.c 1997/08/07 07:33:10 @@ -206,7 +206,7 @@ offset = 0; brelse (bh); } - if (!IS_RDONLY(inode)) { + if (DO_UPDATE_ATIME(inode)) { inode->i_atime = CURRENT_TIME; inode->i_dirt = 1; } --- fs/ext2/symlink.c +++ fs/ext2/symlink.c 1997/08/07 07:34:14 @@ -86,7 +86,7 @@ link = bh->b_data; } else link = (char *) inode->u.ext2_i.i_data; - if (!IS_RDONLY(inode)) { + if (DO_UPDATE_ATIME(inode)) { inode->i_atime = CURRENT_TIME; inode->i_dirt = 1; } @@ -127,7 +127,7 @@ i++; put_user (c, buffer++); } - if (!IS_RDONLY(inode)) { + if (DO_UPDATE_ATIME(inode)) { inode->i_atime = CURRENT_TIME; inode->i_dirt = 1; } --- fs/super.c +++ fs/super.c 1997/08/07 07:35:44 @@ -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 --- include/linux/fs.h +++ include/linux/fs.h 1997/08/07 07:38:36 @@ -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 @@ -93,7 +94,10 @@ * * Exception: MS_RDONLY is always applied to the entire file system. */ -#define IS_RDONLY(inode) (((inode)->i_sb) && ((inode)->i_sb->s_flags & MS_RDONLY)) +#define IS_RDONLY(inode) \ + (((inode)->i_sb) && ((inode)->i_sb->s_flags & MS_RDONLY)) +#define DO_UPDATE_ATIME(inode) \ + (!((inode)->i_flags & MS_NOATIME) && !IS_RDONLY(inode)) #define IS_NOSUID(inode) ((inode)->i_flags & MS_NOSUID) #define IS_NODEV(inode) ((inode)->i_flags & MS_NODEV) #define IS_NOEXEC(inode) ((inode)->i_flags & MS_NOEXEC) --- mm/filemap.c +++ mm/filemap.c 1997/08/07 07:46:57 @@ -736,7 +736,7 @@ filp->f_reada = 1; if (page_cache) free_page(page_cache); - if (!IS_RDONLY(inode)) { + if (DO_UPDATE_ATIME(inode)) { inode->i_atime = CURRENT_TIME; inode->i_dirt = 1; } @@ -1175,7 +1175,7 @@ return -EACCES; if (!inode->i_op || !inode->i_op->readpage) return -ENOEXEC; - if (!IS_RDONLY(inode)) { + if (DO_UPDATE_ATIME(inode)) { inode->i_atime = CURRENT_TIME; inode->i_dirt = 1; }
| |