xfs
[Top] [All Lists]

[PATCH] flush inode when changing atime.

To: xfs@xxxxxxxxxxx
Subject: [PATCH] flush inode when changing atime.
From: Utako Kusaka <u-kusaka@xxxxxxxxxxxxx>
Date: Wed, 17 Oct 2007 13:56:00 +0900
Sender: xfs-bounce@xxxxxxxxxxx
Hi,

The atime is changed for reading but it returns to a previous value
after unmount. i_update_core is still off after reading a file using
read(), readdir() and readlink(). So an inode isn't flushed to disk.

I referred to following fix when I made a patch:
TAKE 946679 - fix, speedup and simplify atime handling
http://marc.info/?l=linux-xfs&m=113398234310217&w=4

Example:
# ls -lu mpnt/log3
-rw-r--r--  1 root root 63494 2007-04-05 16:35 mpnt/log3
# less mpnt/log3
# ls -lu mpnt/log3
-rw-r--r--  1 root root 63494 2007-10-05 15:27 mpnt/log3
# umount mpnt/
# mount -t xfs /dev/sda6 mpnt
# ls -lu mpnt/log3
-rw-r--r--  1 root root 63494 2007-04-05 16:35 mpnt/log3

--
Utako

Signed-off-by: Utako Kusaka <u-kusaka@xxxxxxxxxxxxx>
----------
--- linux-2.6-xfs.orig/fs/xfs/xfs_vnodeops.c    2007-10-15 15:50:10.000000000 
+0900
+++ linux-2.6-xfs/fs/xfs/xfs_vnodeops.c 2007-10-15 16:49:35.000000000 +0900
@@ -1003,6 +1003,8 @@ xfs_readlink(
                error = xfs_readlink_bmap(ip, link);
        }
 
+       ip->i_update_core = 1;
+
  out:
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
        return error;
--- linux-2.6-xfs.orig/fs/xfs/xfs_dir2.c        2007-10-15 15:50:09.000000000 
+0900
+++ linux-2.6-xfs/fs/xfs/xfs_dir2.c     2007-10-15 16:48:47.000000000 +0900
@@ -318,6 +318,9 @@ xfs_readdir(
        else
                rval = xfs_dir2_leaf_getdents(dp, dirent, bufsize, offset,
                                              filldir);
+
+       dp->i_update_core = 1;
+
        return rval;
 }
 
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_lrw.c       2007-10-15 
15:50:10.000000000 +0900
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_lrw.c    2007-10-15 16:50:50.000000000 
+0900
@@ -275,6 +275,9 @@ xfs_read(
                XFS_STATS_ADD(xs_read_bytes, ret);
 
        xfs_iunlock(ip, XFS_IOLOCK_SHARED);
+
+       if (likely(!(ioflags & IO_INVIS)))
+               ip->i_update_core = 1;
        return ret;
 }
 
----------


<Prev in Thread] Current Thread [Next in Thread>