diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index da0159d99f82..cd42ef78f6b5 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
| @@ -57,19 +57,22 @@ | |||
| 57 | #include <linux/fiemap.h> | 57 | #include <linux/fiemap.h> |
| 58 | 58 | ||
| 59 | /* | 59 | /* |
| 60 | * Bring the atime in the XFS inode uptodate. | 60 | * Bring the timestamps in the XFS inode uptodate. |
| 61 | * Used before logging the inode to disk or when the Linux inode goes away. | 61 | * |
| 62 | * Used before writing the inode to disk. | ||
| 62 | */ | 63 | */ |
| 63 | void | 64 | void |
| 64 | xfs_synchronize_atime( | 65 | xfs_synchronize_times( |
| 65 | xfs_inode_t *ip) | 66 | xfs_inode_t *ip) |
| 66 | { | 67 | { |
| 67 | struct inode *inode = VFS_I(ip); | 68 | struct inode *inode = VFS_I(ip); |
| 68 | 69 | ||
| 69 | if (!(inode->i_state & I_CLEAR)) { | 70 | ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec; |
| 70 | ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec; | 71 | ip->i_d.di_atime.t_nsec = (__int32_t)inode->i_atime.tv_nsec; |
| 71 | ip->i_d.di_atime.t_nsec = (__int32_t)inode->i_atime.tv_nsec; | 72 | ip->i_d.di_ctime.t_sec = (__int32_t)inode->i_ctime.tv_sec; |
| 72 | } | 73 | ip->i_d.di_ctime.t_nsec = (__int32_t)inode->i_ctime.tv_nsec; |
| 74 | ip->i_d.di_mtime.t_sec = (__int32_t)inode->i_mtime.tv_sec; | ||
| 75 | ip->i_d.di_mtime.t_nsec = (__int32_t)inode->i_mtime.tv_nsec; | ||
| 73 | } | 76 | } |
| 74 | 77 | ||
| 75 | /* | 78 | /* |
| @@ -106,32 +109,20 @@ xfs_ichgtime( | |||
| 106 | if ((flags & XFS_ICHGTIME_MOD) && | 109 | if ((flags & XFS_ICHGTIME_MOD) && |
| 107 | !timespec_equal(&inode->i_mtime, &tv)) { | 110 | !timespec_equal(&inode->i_mtime, &tv)) { |
| 108 | inode->i_mtime = tv; | 111 | inode->i_mtime = tv; |
| 109 | ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec; | ||
| 110 | ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec; | ||
| 111 | sync_it = 1; | 112 | sync_it = 1; |
| 112 | } | 113 | } |
| 113 | if ((flags & XFS_ICHGTIME_CHG) && | 114 | if ((flags & XFS_ICHGTIME_CHG) && |
| 114 | !timespec_equal(&inode->i_ctime, &tv)) { | 115 | !timespec_equal(&inode->i_ctime, &tv)) { |
| 115 | inode->i_ctime = tv; | 116 | inode->i_ctime = tv; |
| 116 | ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec; | ||
| 117 | ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec; | ||
| 118 | sync_it = 1; | 117 | sync_it = 1; |
| 119 | } | 118 | } |
| 120 | 119 | ||
| 121 | /* | 120 | /* |
| 122 | * We update the i_update_core field _after_ changing | 121 | * Update complete - now make sure everyone knows that the inode |
| 123 | * the timestamps in order to coordinate properly with | 122 | * is dirty. |
| 124 | * xfs_iflush() so that we don't lose timestamp updates. | ||
| 125 | * This keeps us from having to hold the inode lock | ||
| 126 | * while doing this. We use the SYNCHRONIZE macro to | ||
| 127 | * ensure that the compiler does not reorder the update | ||
| 128 | * of i_update_core above the timestamp updates above. | ||
| 129 | */ | 123 | */ |
| 130 | if (sync_it) { | 124 | if (sync_it) |
| 131 | SYNCHRONIZE(); | ||
| 132 | ip->i_update_core = 1; | ||
| 133 | xfs_mark_inode_dirty_sync(ip); | 125 | xfs_mark_inode_dirty_sync(ip); |
| 134 | } | ||
| 135 | } | 126 | } |
| 136 | 127 | ||
| 137 | /* | 128 | /* |
| @@ -506,10 +497,8 @@ xfs_vn_getattr( | |||
| 506 | stat->gid = ip->i_d.di_gid; | 497 | stat->gid = ip->i_d.di_gid; |
| 507 | stat->ino = ip->i_ino; | 498 | stat->ino = ip->i_ino; |
| 508 | stat->atime = inode->i_atime; | 499 | stat->atime = inode->i_atime; |
| 509 | stat->mtime.tv_sec = ip->i_d.di_mtime.t_sec; | 500 | stat->mtime = inode->i_mtime; |
| 510 | stat->mtime.tv_nsec = ip->i_d.di_mtime.t_nsec; | 501 | stat->ctime = inode->i_ctime; |
| 511 | stat->ctime.tv_sec = ip->i_d.di_ctime.t_sec; | ||
| 512 | stat->ctime.tv_nsec = ip->i_d.di_ctime.t_nsec; | ||
| 513 | stat->blocks = | 502 | stat->blocks = |
| 514 | XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks); | 503 | XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks); |
| 515 | 504 | ||
