aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_inode.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/xfs/xfs_trans_inode.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/xfs/xfs_trans_inode.c')
-rw-r--r--fs/xfs/xfs_trans_inode.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index cdc53a1050c5..048b0c689d3e 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -44,28 +44,6 @@ xfs_trans_inode_broot_debug(
44#endif 44#endif
45 45
46/* 46/*
47 * Get an inode and join it to the transaction.
48 */
49int
50xfs_trans_iget(
51 xfs_mount_t *mp,
52 xfs_trans_t *tp,
53 xfs_ino_t ino,
54 uint flags,
55 uint lock_flags,
56 xfs_inode_t **ipp)
57{
58 int error;
59
60 error = xfs_iget(mp, tp, ino, flags, lock_flags, ipp);
61 if (!error && tp) {
62 xfs_trans_ijoin(tp, *ipp);
63 (*ipp)->i_itemp->ili_lock_flags = lock_flags;
64 }
65 return error;
66}
67
68/*
69 * Add a locked inode to the transaction. 47 * Add a locked inode to the transaction.
70 * 48 *
71 * The inode must be locked, and it cannot be associated with any transaction. 49 * The inode must be locked, and it cannot be associated with any transaction.
@@ -103,7 +81,7 @@ xfs_trans_ijoin(
103 * 81 *
104 * 82 *
105 * Grabs a reference to the inode which will be dropped when the transaction 83 * Grabs a reference to the inode which will be dropped when the transaction
106 * is commited. The inode will also be unlocked at that point. The inode 84 * is committed. The inode will also be unlocked at that point. The inode
107 * must be locked, and it cannot be associated with any transaction. 85 * must be locked, and it cannot be associated with any transaction.
108 */ 86 */
109void 87void
@@ -118,6 +96,36 @@ xfs_trans_ijoin_ref(
118} 96}
119 97
120/* 98/*
99 * Transactional inode timestamp update. Requires the inode to be locked and
100 * joined to the transaction supplied. Relies on the transaction subsystem to
101 * track dirty state and update/writeback the inode accordingly.
102 */
103void
104xfs_trans_ichgtime(
105 struct xfs_trans *tp,
106 struct xfs_inode *ip,
107 int flags)
108{
109 struct inode *inode = VFS_I(ip);
110 timespec_t tv;
111
112 ASSERT(tp);
113 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
114 ASSERT(ip->i_transp == tp);
115
116 tv = current_fs_time(inode->i_sb);
117
118 if ((flags & XFS_ICHGTIME_MOD) &&
119 !timespec_equal(&inode->i_mtime, &tv)) {
120 inode->i_mtime = tv;
121 }
122 if ((flags & XFS_ICHGTIME_CHG) &&
123 !timespec_equal(&inode->i_ctime, &tv)) {
124 inode->i_ctime = tv;
125 }
126}
127
128/*
121 * This is called to mark the fields indicated in fieldmask as needing 129 * This is called to mark the fields indicated in fieldmask as needing
122 * to be logged when the transaction is committed. The inode must 130 * to be logged when the transaction is committed. The inode must
123 * already be associated with the given transaction. 131 * already be associated with the given transaction.