diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-06-06 17:01:28 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-07-22 11:38:32 -0400 |
commit | 69ff2826117f1cde9a2491be57a578212bca551e (patch) | |
tree | 5054885441e91a48787939d294d42abada6309cc /fs/xfs/xfs_super.c | |
parent | 96ee34be7a0965a117080a28b2c0cc6d4ee6adb1 (diff) |
xfs: implement ->update_time
Use this new method to replace our hacky use of ->dirty_inode. An additional
benefit is that we can now propagate errors up the stack.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_super.c')
-rw-r--r-- | fs/xfs/xfs_super.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 07f70e17c745..cb2deb13b063 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -868,61 +868,6 @@ xfs_fs_inode_init_once( | |||
868 | "xfsino", ip->i_ino); | 868 | "xfsino", ip->i_ino); |
869 | } | 869 | } |
870 | 870 | ||
871 | /* | ||
872 | * This is called by the VFS when dirtying inode metadata. This can happen | ||
873 | * for a few reasons, but we only care about timestamp updates, given that | ||
874 | * we handled the rest ourselves. In theory no other calls should happen, | ||
875 | * but for example generic_write_end() keeps dirtying the inode after | ||
876 | * updating i_size. Thus we check that the flags are exactly I_DIRTY_SYNC, | ||
877 | * and skip this call otherwise. | ||
878 | * | ||
879 | * We'll hopefull get a different method just for updating timestamps soon, | ||
880 | * at which point this hack can go away, and maybe we'll also get real | ||
881 | * error handling here. | ||
882 | */ | ||
883 | STATIC void | ||
884 | xfs_fs_dirty_inode( | ||
885 | struct inode *inode, | ||
886 | int flags) | ||
887 | { | ||
888 | struct xfs_inode *ip = XFS_I(inode); | ||
889 | struct xfs_mount *mp = ip->i_mount; | ||
890 | struct xfs_trans *tp; | ||
891 | int error; | ||
892 | |||
893 | if (flags != I_DIRTY_SYNC) | ||
894 | return; | ||
895 | |||
896 | trace_xfs_dirty_inode(ip); | ||
897 | |||
898 | tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS); | ||
899 | error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0); | ||
900 | if (error) { | ||
901 | xfs_trans_cancel(tp, 0); | ||
902 | goto trouble; | ||
903 | } | ||
904 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
905 | /* | ||
906 | * Grab all the latest timestamps from the Linux inode. | ||
907 | */ | ||
908 | ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec; | ||
909 | ip->i_d.di_atime.t_nsec = (__int32_t)inode->i_atime.tv_nsec; | ||
910 | ip->i_d.di_ctime.t_sec = (__int32_t)inode->i_ctime.tv_sec; | ||
911 | ip->i_d.di_ctime.t_nsec = (__int32_t)inode->i_ctime.tv_nsec; | ||
912 | ip->i_d.di_mtime.t_sec = (__int32_t)inode->i_mtime.tv_sec; | ||
913 | ip->i_d.di_mtime.t_nsec = (__int32_t)inode->i_mtime.tv_nsec; | ||
914 | |||
915 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | ||
916 | xfs_trans_log_inode(tp, ip, XFS_ILOG_TIMESTAMP); | ||
917 | error = xfs_trans_commit(tp, 0); | ||
918 | if (error) | ||
919 | goto trouble; | ||
920 | return; | ||
921 | |||
922 | trouble: | ||
923 | xfs_warn(mp, "failed to update timestamps for inode 0x%llx", ip->i_ino); | ||
924 | } | ||
925 | |||
926 | STATIC void | 871 | STATIC void |
927 | xfs_fs_evict_inode( | 872 | xfs_fs_evict_inode( |
928 | struct inode *inode) | 873 | struct inode *inode) |
@@ -1436,7 +1381,6 @@ xfs_fs_free_cached_objects( | |||
1436 | static const struct super_operations xfs_super_operations = { | 1381 | static const struct super_operations xfs_super_operations = { |
1437 | .alloc_inode = xfs_fs_alloc_inode, | 1382 | .alloc_inode = xfs_fs_alloc_inode, |
1438 | .destroy_inode = xfs_fs_destroy_inode, | 1383 | .destroy_inode = xfs_fs_destroy_inode, |
1439 | .dirty_inode = xfs_fs_dirty_inode, | ||
1440 | .evict_inode = xfs_fs_evict_inode, | 1384 | .evict_inode = xfs_fs_evict_inode, |
1441 | .drop_inode = xfs_fs_drop_inode, | 1385 | .drop_inode = xfs_fs_drop_inode, |
1442 | .put_super = xfs_fs_put_super, | 1386 | .put_super = xfs_fs_put_super, |